Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
dusan.naus.trz
298 Views, 4 Replies

iLogic Half Section View Settings Value Offset

How to preset value 5 via iLogic?

2024-02-18_22h06_27.png

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)
Dim normal As Vector = ThisApplication.TransientGeometry.CreateVector(-10)
Dim plane1 As Plane = ThisApplication.TransientGeometry.CreatePlane(rootPoint, normal)
viewRep.SetSectionView(SectionViewTypeEnum.kHalfSectionViewType, plane1)

 

 

nmunro
in reply to: dusan.naus.trz

If it works as is but with no offset, it looks like you just need to adjust the definition of rootPoint to include the offset in the desired direction. The root point lies on the transient plane, your code has it on the plane you select.

        


https://c3mcad.com

dusan.naus.trz
in reply to: nmunro

I tried it and it gives me errors. I can't redefine it to plain + Double value. I don't know how to redefine it.

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

dusan.naus.trz
in reply to: nmunro

Hello, It's nice. Everything works. Thank you. 

I am not yet aware of the relationships in the code between each other. I hope that one day it will come and I will understand the relationships in the code. Thank you.