View Orientation Normal to active sketch

View Orientation Normal to active sketch

j_weber
Mentor Mentor
903 Views
2 Replies
Message 1 of 3

View Orientation Normal to active sketch

j_weber
Mentor
Mentor

Hi everybody

 

with help I create the following code to create a sketch on the xy-plane 

 

'Set a reference to the part dokument
Dim oDoc As Inventor.Document
oDoc = ThisDoc.Document

' Set a reference to the component definition.
Dim oCompDef As PartComponentDefinition
oCompDef = oDoc.ComponentDefinition

' Create a new sketch on the X-y work plane.
Dim oSketch As PlanarSketch
oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))
    
oSketch.Edit
    
'project origin point
Dim oOriginSketchPoint As SketchPoint
oOriginSketchPoint = oSketch.AddByProjectingEntity(oCompDef.WorkPoints.Item(1))

It work perfect and reduce the clicks a little bit. 

The last thing to make it very perfect is to change the view normal to the sketchplane. Like it is in the sketch command

I think i must change the camara eye but I'm a beginner in programming so I hope someone of the cracks can help me. 

 

Thanks and greetz




Jörg Weber
CAD Systemtechniker für AutoCAD, Inventor, Vault





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

rogmitch
Advocate
Advocate
Accepted solution

Hi Jorg,

 

How about...

 

 oDoc.SelectSet.Select oSketch

Dim oControlDef As ControlDefinition
Set oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppLookAtCmd") 'Look at the sketch

oControlDef.Execute

Doevents 'May not need this

 

Good luck

 

Roger Mitchell 

0 Likes
Message 3 of 3

j_weber
Mentor
Mentor

Hi Roger, 

 

thanks for help.

 

I think that is the way I must look for. 

 

Thanks again an a nice weekend. 




Jörg Weber
CAD Systemtechniker für AutoCAD, Inventor, Vault





0 Likes