SketchBlockDefinition LinkToFile Problem...?

I'm trying to set LinkToFile property of SketchBlockDefinition to False, and I keep failing.

Is there a particular order this need to be done?

I can manage to enable the link when disabled, but can't disable it when enabled. Is this a glitch?

What am I doing wrong?

Also, another thing I noticed was, when a block is linked, if any relations are added between the sketch and the insertion / any gemotry of the block, they get lost after exiting the sketch for some reason....is this intended behavior? This is why I want to disable the link, since, when the block is unlinked, the relations seem to be kept.

To produce the problem, just create a sketch named "FirstRib" and instert a block into it, and name it "Profile" (whcih, in the end should be profile instance 1 - "Profile-1").

Below are some snap-shots, and a sample code...to reproduce the problem.

Thanks in advance


Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Dim BLKinst As SldWorks.SketchBlockInstance
Dim BLKdef As SldWorks.SketchBlockDefinition
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("FirstRib", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch False
boolstatus = Part.Extension.SelectByID2("Profile-1", "SUBSKETCHINST", 0, 0, 0, False, 0, Nothing, 0)
Dim selMgr As SldWorks.SelectionMgr
Set selMgr = Part.SelectionManager
Set BLKinst = selMgr.GetSelectedObject6(1, 0)
Set BLKdef = BLKinst.Definition
BLKdef.LinkToFile = True   'This should toggle the link to file checkbox...
MsgBox BLKdef.LinkToFile
Part.SketchManager.InsertSketch True
End Sub

SolidworksApi macros