02-25-2023
03:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-25-2023
03:18 PM
Hi @tmathieson. No problem!
You will need to create an extent point: the maximum distance from the origin about both plane's root point. Then use that extent point as the input point for creating the work axis. The extent root point is needed now since the scope no longer involves just origin planes with (0,0,0) root points.
VBA
...
'extent point
Dim extentX As Double
Dim extentY As Double
Dim extentZ As Double
If (Abs(planeOne.Plane.RootPoint.x) >= Abs(planeTwo.Plane.RootPoint.x)) Then
extentX = planeOne.Plane.RootPoint.x
Else
extentX = planeTwo.Plane.RootPoint.x
End If
If (Abs(planeOne.Plane.RootPoint.y) >= Abs(planeTwo.Plane.RootPoint.y)) Then
extentY = planeOne.Plane.RootPoint.y
Else
extentY = planeTwo.Plane.RootPoint.y
End If
If (Abs(planeOne.Plane.RootPoint.Z) >= Abs(planeTwo.Plane.RootPoint.Z)) Then
extentZ = planeOne.Plane.RootPoint.Z
Else
extentZ = planeTwo.Plane.RootPoint.Z
End If
Dim pointExtent As Inventor.Point
Set pointExtent = tg.CreatePoint( _
xcoord:=extentX, _
ycoord:=extentY, _
zcoord:=extentZ)
'work axis
Dim wa As Inventor.WorkAxis
Set wa = asmdoc.ComponentDefinition.WorkAxes.AddFixed( _
Point:=pointExtent, _
Axis:=inv.TransientGeometry.CreateUnitVector(cp(0), cp(1), cp(2)))
...
For getting planes with names, you can just write the name in the .items collection to retrieve them. And you're correct, no need for proxies for the planes since they are in the root assembly document.
...
planeOne = asmdoc.ComponentDefinition.WorkPlanes.Item("YZ Plane")
planeTwo = asmdoc.ComponentDefinition.WorkPlanes.Item("INSIDE AREA-RISE")
...