Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sketch Constrain End Points with Ilogic?

3 REPLIES 3
Reply
Message 1 of 4
davis.j
346 Views, 3 Replies

Sketch Constrain End Points with Ilogic?

davis.j
Advocate
Advocate

Is there a way to auto constrain end points with ILogic. When I pull in Step files and redraw them the ends aren't constrained. It seems like it is only an issue with arcs to lines. (lines to line are already constrained.)

 

I use the auto dimension too and turn off dimensions and leave constraints on but it doesnt attached the arcs to lines.

 

 

davisj_1-1663091956180.png

 

davisj_0-1663090941406.png

 

0 Likes

Sketch Constrain End Points with Ilogic?

Is there a way to auto constrain end points with ILogic. When I pull in Step files and redraw them the ends aren't constrained. It seems like it is only an issue with arcs to lines. (lines to line are already constrained.)

 

I use the auto dimension too and turn off dimensions and leave constraints on but it doesnt attached the arcs to lines.

 

 

davisj_1-1663091956180.png

 

davisj_0-1663090941406.png

 

Labels (4)
3 REPLIES 3
Message 2 of 4
Michael.Navara
in reply to: davis.j

Michael.Navara
Advisor
Advisor

 

You can merge sketch points in sketch using iLogic. Here is the sample without error checking, but it is start point how to do it

'Planar sketch must be active
Dim oSketch As PlanarSketch = ThisApplication.ActiveEditObject
Dim partDef As PartComponentDefinition = oSketch.Parent
Dim selectionFilter As SelectionFilterEnum() = New SelectionFilterEnum() {SelectionFilterEnum.kSketchPointFilter }
Dim tolerance As Double = 0.1 ' 1 = 1cm

For Each oSketchPoint As SketchPoint In oSketch.SketchPoints
	Dim nearSketchPoints As ObjectsEnumerator = partDef.FindUsingPoint(oSketchPoint.Geometry3d, selectionFilter, tolerance)
	For Each nearSketchPoint As SketchPoint In nearSketchPoints
		If nearSketchPoint Is oSketchPoint Then Continue For
		If nearSketchPoint.Parent.Name <> oSketch.Name Then Continue For
		oSketchPoint.Merge(nearSketchPoint)
	Next
Next

 

You can merge sketch points in sketch using iLogic. Here is the sample without error checking, but it is start point how to do it

'Planar sketch must be active
Dim oSketch As PlanarSketch = ThisApplication.ActiveEditObject
Dim partDef As PartComponentDefinition = oSketch.Parent
Dim selectionFilter As SelectionFilterEnum() = New SelectionFilterEnum() {SelectionFilterEnum.kSketchPointFilter }
Dim tolerance As Double = 0.1 ' 1 = 1cm

For Each oSketchPoint As SketchPoint In oSketch.SketchPoints
	Dim nearSketchPoints As ObjectsEnumerator = partDef.FindUsingPoint(oSketchPoint.Geometry3d, selectionFilter, tolerance)
	For Each nearSketchPoint As SketchPoint In nearSketchPoints
		If nearSketchPoint Is oSketchPoint Then Continue For
		If nearSketchPoint.Parent.Name <> oSketch.Name Then Continue For
		oSketchPoint.Merge(nearSketchPoint)
	Next
Next
Message 3 of 4
davis.j
in reply to: Michael.Navara

davis.j
Advocate
Advocate

@Michael.Navara  Thanks for your input. I'd like to figure out what the DWG import tool's "Constrain End points" actually does.  If I export the sketch as a DWG, delete the geometry and then import that DWG it allows me to click that checkbox and then everything is connected once the import is done. The only problem is that there is a high change of Inventor crashing. (What else is new? 😁)

davisj_0-1663187757497.png

 

0 Likes

@Michael.Navara  Thanks for your input. I'd like to figure out what the DWG import tool's "Constrain End points" actually does.  If I export the sketch as a DWG, delete the geometry and then import that DWG it allows me to click that checkbox and then everything is connected once the import is done. The only problem is that there is a high change of Inventor crashing. (What else is new? 😁)

davisj_0-1663187757497.png

 

Message 4 of 4
Michael.Navara
in reply to: davis.j

Michael.Navara
Advisor
Advisor

In my opinion the check box has similar effect as my code mentioned above.

If the Inventor crashes during this operation, it is a question to Autodesk. I have no idea.   

0 Likes

In my opinion the check box has similar effect as my code mentioned above.

If the Inventor crashes during this operation, it is a question to Autodesk. I have no idea.   

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

Post to forums  

Autodesk Design & Make Report