Sketch Constrain End Points with Ilogic?

davis.j
Advocate
Advocate

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
Reply
383 Views
3 Replies
Replies (3)

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

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