Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
nmunro
in reply to: dusan.naus.trz

I made a few small edits to your rule and it seems to work well. See the embedded notes for suggestions on making it more generic. The offset point would also have to be calculated based on the selected plane normal.

 

 

Dim asm As AssemblyDocument = ThisDoc.Document
Dim asmDef As AssemblyComponentDefinition = asm.ComponentDefinition
Dim viewRep As DesignViewRepresentation = asmDef.RepresentationsManager.ActiveDesignViewRepresentation
Dim wrkPlane As WorkPlane = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Pick a Workplane")
Dim rootPoint As Point
Dim xAxis,yAxis As UnitVector
wrkPlane.GetPosition(rootPoint, xAxis, yAxis)

' The following is based on the selection of the assembly YZ plane by the user (or a parallel plane)
' To make this generic, you would need to get the normal for the selected plane (cross product of xAxis & yAxis vectors) 
Dim offset As Double = 5  ' 5cm offset
Dim planeBasePt As Point = ThisApplication.TransientGeometry.CreatePoint(rootPoint.X + offset, rootPoint.Y, rootPoint.Z)
' The calculated  plane normaln would replace this fixed vector
Dim planeNormal As Vector = ThisApplication.TransientGeometry.CreateVector(1, 0, 0)

' replaced root point with the offset plane definition
Dim plane1 As Plane = ThisApplication.TransientGeometry.CreatePlane(planeBasePt, planeNormal)
viewRep.SetSectionView(SectionViewTypeEnum.kHalfSectionViewType, plane1)

 

        


https://c3mcad.com