Create Sketch on Face but Sketch doesn't rotate to front

Create Sketch on Face but Sketch doesn't rotate to front

Tiffany_Hayden_
Collaborator Collaborator
514 Views
2 Replies
Message 1 of 3

Create Sketch on Face but Sketch doesn't rotate to front

Tiffany_Hayden_
Collaborator
Collaborator

I'm creating a sketch on a face but when the sketch is created and in edit mode the sketch doesn't rotate forward. I'm hoping there is something simple but I can't seem to find it. Any help would be greatly appreciated! 

 

    Dim oDoc As PartDocument: Set oDoc = ThisApplication.ActiveDocument
    Dim oPartDef As PartComponentDefinition: Set oPartDef = oDoc.ComponentDefinition
    
    Dim oFace As Face: Set oFace = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartFaceFilter, "Select the face")
    

    Dim oSketch As PlanarSketch: Set oSketch = oPartDef.Sketches.Add(oFace, True)
    oSketch.Edit

This is what it looks like when the above code is finished. 

 

Sketch Not Rotating.PNG

 

This is what I want it to do. This will make it where the user doesn't have to rotate it front to start drawing. 

 

sketch rotated.PNG

 

Thank you! 

Tiffany

 

 

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

0 Likes
Accepted solutions (1)
515 Views
2 Replies
Replies (2)
Message 2 of 3

HideoYamada
Advisor
Advisor
Accepted solution

Hello,

 

Change the code like this :

    Dim oDoc As PartDocument: Set oDoc = ThisApplication.ActiveDocument
    Dim oPartDef As PartComponentDefinition: Set oPartDef = oDoc.ComponentDefinition
    
    Dim oFace As Face: Set oFace = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartFaceFilter, "Select the face")
    

    Dim oSketch As PlanarSketch: Set oSketch = oPartDef.Sketches.Add(oFace, True)
    'oSketch.Edit
    oDoc.SelectSet.Select oSketch
    ThisApplication.CommandManager.ControlDefinitions("AppSketch2DWrapperCmd").Execute

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 3 of 3

Tiffany_Hayden_
Collaborator
Collaborator

That worked! Thank you @HideoYamada  for your help!

 

Tiffany

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

0 Likes