Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@They_Call_Me_Jake,

 

Try below iLogic code to project entities to new sketch. After selection of edges, press "Esc" key to complete edge selection.

'  a reference to the currently active document.
' This assumes that it is a part document.
Dim oPart As PartDocument
oPart = ThisApplication.ActiveDocument

'  a reference to the component definition.
Dim oDef As PartComponentDefinition
oDef = oPart.ComponentDefinition

Dim oSketch As PlanarSketch
oSketch = oDef.Sketches.Add(ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select Face to Place Sketch"))

sketchName = InputBox("Give your new sketch a name", "Sketch Name", "Enter Sketch Name Here")
oSketch.Name = sketchName
oSketch.Edit

Dim edges As ObjectCollection  
Dim edge As Edge 

edges = ThisApplication.TransientObjects.CreateObjectCollection

While True
	edge = ThisApplication.CommandManager.Pick(
		SelectionFilterEnum.kPartEdgeFilter, 
		"Select a edge") 
		
	' If nothing gets selected then we're done	
	If IsNothing(edge) Then Exit While
	
	edges.Add(edge) 
End While

' If there are selected components we can do something
For Each edge In edges
	Call oSketch.AddByProjectingEntity(edge)
Next

oSketch.ExitEdit

Please feel free to contact if there is any queries.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network