Ardana Eng
Automotive
- Mar 28, 2022
- 1
Dear all, I'm a new user of this forum. Thank you for accepting me.
Please help me to complete my code here. Since I do not have DMU (License), I have to create a custom section with macro. I do not know much about VBA codes as well. For more, please see my attached image and my code below
'DMU_Custom section
Sub CATMain()
Dim Prod As Product
Set Prod = CATIA.ActiveDocument.Product
Dim Sects As Object
Set Sects = Prod.GetTechnologicalObject("Sections")
Call Sects.Add
Dim Sect As Object
Set Sect = Sects.Item(Sects.Count)
'Behavior option
'0-catSectionBehaviorManual
'1-catSectionBehaviorAutomatic
'2-catSectionBehaviorFreeze
Sect.Behavior = 1
'Vol Cut Section
'0-without clipping 1-clipping
Sect.CutMode = 1
'Matrix transformation
Dim MatrixPos(11) As Variant
MatrixPos(0) = 0 'X component of the X-axis (z1)
MatrixPos(1) = 1 'Y component of the X-axis (x1)
MatrixPos(2) = 0 'Z component of the X-axis (y1)
MatrixPos(3) = 0 'X component of the Y-axis (y1)
MatrixPos(4) = 0 'Y component of the Y-axis (z1)
MatrixPos(5) = 1 'Z component of the Y-axis (x1)
MatrixPos(6) = 1 'X component of the Z-axis (x1)
MatrixPos(7) = 0 'Y component of the Z-axis (y1)
MatrixPos(8) = 0 'Z component of the Z-axis (z1)
MatrixPos(9) = -10 'X component of the origin
MatrixPos(10) = 0 'Y component of the origin
MatrixPos(11) = 0 'Z component of the origin
Call Sect.SetPosition(MatrixPos)
End Sub
I would be appreciated if someone can help me.
Thank you. Dan
Please help me to complete my code here. Since I do not have DMU (License), I have to create a custom section with macro. I do not know much about VBA codes as well. For more, please see my attached image and my code below

'DMU_Custom section
Sub CATMain()
Dim Prod As Product
Set Prod = CATIA.ActiveDocument.Product
Dim Sects As Object
Set Sects = Prod.GetTechnologicalObject("Sections")
Call Sects.Add
Dim Sect As Object
Set Sect = Sects.Item(Sects.Count)
'Behavior option
'0-catSectionBehaviorManual
'1-catSectionBehaviorAutomatic
'2-catSectionBehaviorFreeze
Sect.Behavior = 1
'Vol Cut Section
'0-without clipping 1-clipping
Sect.CutMode = 1
'Matrix transformation
Dim MatrixPos(11) As Variant
MatrixPos(0) = 0 'X component of the X-axis (z1)
MatrixPos(1) = 1 'Y component of the X-axis (x1)
MatrixPos(2) = 0 'Z component of the X-axis (y1)
MatrixPos(3) = 0 'X component of the Y-axis (y1)
MatrixPos(4) = 0 'Y component of the Y-axis (z1)
MatrixPos(5) = 1 'Z component of the Y-axis (x1)
MatrixPos(6) = 1 'X component of the Z-axis (x1)
MatrixPos(7) = 0 'Y component of the Z-axis (y1)
MatrixPos(8) = 0 'Z component of the Z-axis (z1)
MatrixPos(9) = -10 'X component of the origin
MatrixPos(10) = 0 'Y component of the origin
MatrixPos(11) = 0 'Z component of the origin
Call Sect.SetPosition(MatrixPos)
End Sub
I would be appreciated if someone can help me.
Thank you. Dan