ilogic project center point into Sketch

ilogic project center point into Sketch

dimamazutaMMJ32
Advocate Advocate
660 Views
3 Replies
Message 1 of 4

ilogic project center point into Sketch

dimamazutaMMJ32
Advocate
Advocate

Hello.

When I copy sketch from one part to another the center point is not created in the new sketch. Is there a way to project a center point into a sketch using ilogic?

Thank you for your help.

0 Likes
Accepted solutions (2)
661 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

is this what you are looking for

Dim sketch As PlanarSketch = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities, "")

Dim partDef As PartComponentDefinition = sketch.Parent

Dim cp = partDef.WorkPoints.Item("Center Point")

sketch.AddByProjectingEntity(cp)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 4

dalton98
Collaborator
Collaborator
Accepted solution

It automatically projects the origin point if you manually start a new sketch so im assuming your creating the sketch with ilogic aswell?

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
oSketch = oDoc.ComponentDefinition.Sketches.Add(oCompDef.WorkPlanes.Item("XY Plane"))
'add origin point
oSketch.AddByProjectingEntity(oCompDef.WorkPoints.Item("Center Point"))

oSketch.Edit
Dim oPasteControlDef As ControlDefinition
oPasteControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppPasteCmd")
oPasteControlDef.Execute
oSketch.ExitEdit
0 Likes
Message 4 of 4

dimamazutaMMJ32
Advocate
Advocate

Yes, I create sketch with ilogic.

Thanks for your help!

0 Likes