06-25-2018
04:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-25-2018
04:16 AM
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
