I want to add geometric constraint at sketchLines. Can somebody tell me how can I use the fix in the vba?
Solved! Go to Solution.
Solved by gcoombridge. Go to Solution.
I'd say this would be it:
Do you mean fix the distance of multiple sketchpoints or fixed the distance between sketchpoints?
To fix ALL the sketchpoints in a sketch you could do this:
Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch = oDef.Sketches.Item("Sketch1")
Dim oSketchpoint As SketchPoint
For Each oSketchpoint In oSketch.SketchPoints
Try
oSketch.GeometricConstraints.AddGround(oSketchpoint)
Catch ' Do nothing
End Try
Next oSketchpoint
The try-catch is needed to stop it erroring on the grounded origin point. To pick certain ones is difficult because they are only referred to with an index. You may get more informed help on the ilogic specific forum also...
I mean i wanted to make relation between sketchpoints. If there is 1,2,3,4,5 named points and want to make 2,3,4,5 distance fixed. If i move 2and i want 3,4,5 also can be moved with same distance
If they have a specific relationship, but will need to move you should use other geometric constraints, for example horizontal and vertical. Then use the API to create dimensions between them. If you used fixed (grounded) constraints you will very quickly over-constrain your sketch and be unable to do anything with it.
I find it easier to make the sketch entities in the same rule because then you can name them... i.e. point1 = .... and refer back to them later in the code. Otherwise they are indexed by order of creation
Can't find what you're looking for? Ask the community or share your knowledge.