Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro sectioning in DMU

Status
Not open for further replies.

iscariot

Mechanical
Oct 15, 2009
154
I want to make a macro that will create a section box in DMU .

Until now I have this code but is not exactly what I need:
Code:
Sub CATMain()
' Retrieve the Sections collection
Dim cSections As Sections
Set cSections = CATIA.ActiveDocument.Product.GetTechnologicalObject("Sections" [Wink]

    ' Create the master section
    Dim oMasterSection As Section
    Set oMasterSection = cSections.Add

    ' Retrieve data on master section
    Dim Position(11)
    oMasterSection.GetPosition Position

Dim SectionType As CatSectionType
    SectionType = oMasterSection.Type
oMasterSection.Type = catSectionTypeBox

Dim SectionMode As Integer
    SectionMode = oMasterSection.CutMode
oMasterSection.CutMode = 1

Dim SectionWidth As double
    SectionWidth = oMasterSection.Width
oMasterSection.Width = 3500.

Dim SectionHeight As double
    SectionHeight = oMasterSection.Height
oMasterSection.Height = 7000.

Dim SectionThickness As double
    SectionThickness = oMasterSection.Thickness
oMasterSection.Thickness = 600.

    Dim MatrixPos (11) As Double
    MatrixPos( 0) = 1.0
    MatrixPos( 1) = 0.0
    MatrixPos( 2) = 0.0
    MatrixPos( 3) = 0.0
    MatrixPos( 4) = 1.0
    MatrixPos( 5) = 0.0
    MatrixPos( 6) = 0.0
    MatrixPos( 7) = 0.0
    MatrixPos( 8) = 1.0
'is the X component of the origin
    MatrixPos( 9) = 11538.0
'is the Y component of the origin
    MatrixPos(10) = 0.0
'is the Z component of the origin
    MatrixPos(11) = 1750.0
    oMasterSection.SetPosition MatrixPos
End Sub
The problem is that the macro create a section box after the Z axis ( as you can see in the picture attached), but I need it after the X axis.
This is my first macro that I am trying to write ... so I don't know exactly where can I find the neccesary code.
(I also posted my question at: )


Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor