Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I want to know how can i use Geometric Constraint fix in vba

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
582 Views, 5 Replies

I want to know how can i use Geometric Constraint fix in vba

elei0947_0-1630388813807.png

I want to add geometric constraint at sketchLines. Can somebody tell me how can I use the fix in the vba?

5 REPLIES 5
Message 2 of 6
gcoombridge
in reply to: Anonymous

I'd say this would be it: 

image.png

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
Message 3 of 6
Anonymous
in reply to: gcoombridge

Thank you for your reply. I have one more question. Is there any way to fix the distance of the sketchPoints more than two?
Message 4 of 6
gcoombridge
in reply to: Anonymous

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... 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
Message 5 of 6
Anonymous
in reply to: gcoombridge

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

 

32706349-D928-4CFF-8CF7-FAC28BC9200C.jpeg

Message 6 of 6
gcoombridge
in reply to: Anonymous

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 

 

 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report