- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to preset value 5 via iLogic?
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)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.