I know this has been discussed in other threads but...Why is the YZ origin plane oriented this way by default? Having the plane oriented this way results in horizontal sketch geometry being vertical in the "right" (view cube) view. That's very frustrating! I thought this was going to change in 15 but it looks like they only made changes to the "look at" command which I do not use because it further complicates this issue. Thoughts? Solutions?
Solved! Go to Solution.
Solved by graemev. Go to Solution.
Sorry,
by default Inventor calculate it using its algorithm (depend what surface you pick and from witch side)
orientation in space can be tricky - then you decide your own "Horizontal"
uu
Public Sub SetBasePlaneAxes()
Dim app As Application
Set app = ThisApplication
' Aktuális dokumentum ellenőrzése
If app.ActiveDocument.DocumentType <> kPartDocumentObject Then
MsgBox "Ez a kód csak alkatrész dokumentumokban futtatható.", vbCritical
Exit Sub
End If
Dim partDoc As PartDocument
Set partDoc = app.ActiveDocument
Dim compDef As PartComponentDefinition
Set compDef = partDoc.ComponentDefinition
Dim oWorkplane As WorkPlane
Dim def As FixedWorkPlaneDef
Dim tg As TransientGeometry
Set tg = app.TransientGeometry
Dim oPoint As Point
Set oPoint = tg.CreatePoint(0, 0, 0)
Dim XVector As UnitVector
Dim YVector As UnitVector
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(1)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(0, 0, -1)
Set YVector = CreateVector(0, 1, 0)
Call def.PutData(oPoint, XVector, YVector)
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(2)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(1, 0, 0)
Set YVector = CreateVector(0, 0, -1)
Call def.PutData(oPoint, XVector, YVector)
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(3)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(1, 0, 0)
Set YVector = CreateVector(0, 1, 0)
Call def.PutData(oPoint, XVector, YVector)
MsgBox "Sík koordináták átállítva"
End Sub
Private Function CreateVector(x As Double, y As Double, z As Double) As UnitVector
Dim app As Application
Set app = ThisApplication
Dim vector As UnitVector
Set vector = app.TransientGeometry.CreateUnitVector(x, y, z)
Set CreateVector = vector
'MsgBox "Vektor létrehozva"
End Function
Public Sub SetBasePlaneAxes()
Dim app As Application
Set app = ThisApplication
' Aktuális dokumentum ellenőrzése
If app.ActiveDocument.DocumentType <> kPartDocumentObject Then
MsgBox "Ez a kód csak alkatrész dokumentumokban futtatható.", vbCritical
Exit Sub
End If
Dim partDoc As PartDocument
Set partDoc = app.ActiveDocument
Dim compDef As PartComponentDefinition
Set compDef = partDoc.ComponentDefinition
Dim oWorkplane As WorkPlane
Dim def As FixedWorkPlaneDef
Dim tg As TransientGeometry
Set tg = app.TransientGeometry
Dim oPoint As Point
Set oPoint = tg.CreatePoint(0, 0, 0)
Dim XVector As UnitVector
Dim YVector As UnitVector
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(1)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(0, 0, -1)
Set YVector = CreateVector(0, 1, 0)
Call def.PutData(oPoint, XVector, YVector)
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(2)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(1, 0, 0)
Set YVector = CreateVector(0, 0, -1)
Call def.PutData(oPoint, XVector, YVector)
'*******************************************************
Set oWorkplane = compDef.WorkPlanes.Item(3)
Set def = oWorkplane.Definition
MsgBox oWorkplane.Name & " sík tengelyei beállítva."
Set XVector = CreateVector(1, 0, 0)
Set YVector = CreateVector(0, 1, 0)
Call def.PutData(oPoint, XVector, YVector)
MsgBox "Sík koordináták átállítva"
End Sub
Private Function CreateVector(x As Double, y As Double, z As Double) As UnitVector
Dim app As Application
Set app = ThisApplication
Dim vector As UnitVector
Set vector = app.TransientGeometry.CreateUnitVector(x, y, z)
Set CreateVector = vector
'MsgBox "Vektor létrehozva"
End Function
Can't find what you're looking for? Ask the community or share your knowledge.