0% found this document useful (0 votes)
27 views2 pages

Macro4.CATScript

The document is a VBScript code that automates the creation of a part in CATIA software. It initializes a new part document, creates a sketch on the XY plane, and draws a circle with a specified radius. The script also sets up the axes and updates the part after completing the sketching process.

Uploaded by

y8ysailing2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Macro4.CATScript

The document is a VBScript code that automates the creation of a part in CATIA software. It initializes a new part document, creates a sketch on the XY plane, and draws a circle with a specified radius. The script also sets up the axes and updates the part after completing the sketching process.

Uploaded by

y8ysailing2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Language="VBSCRIPT"

Sub CATMain()

Dim documents1 As Documents


Set documents1 = CATIA.Documents

Dim partDocument1 As Document


Set partDocument1 = documents1.Add("Part")

Dim part1 As Part


Set part1 = partDocument1.Part

Dim bodies1 As Bodies


Set bodies1 = part1.Bodies

Dim body1 As Body


Set body1 = bodies1.Item("PartBody")

Dim sketches1 As Sketches


Set sketches1 = body1.Sketches

Dim originElements1 As OriginElements


Set originElements1 = part1.OriginElements

Dim reference1 As AnyObject


Set reference1 = originElements1.PlaneXY

Dim sketch1 As Sketch


Set sketch1 = sketches1.Add(reference1)

Dim arrayOfVariantOfDouble1(8)
arrayOfVariantOfDouble1(0) = 0.000000
arrayOfVariantOfDouble1(1) = 0.000000
arrayOfVariantOfDouble1(2) = 0.000000
arrayOfVariantOfDouble1(3) = 1.000000
arrayOfVariantOfDouble1(4) = 0.000000
arrayOfVariantOfDouble1(5) = 0.000000
arrayOfVariantOfDouble1(6) = 0.000000
arrayOfVariantOfDouble1(7) = 1.000000
arrayOfVariantOfDouble1(8) = 0.000000
sketch1.SetAbsoluteAxisData arrayOfVariantOfDouble1

part1.InWorkObject = sketch1

Dim factory2D1 As Factory2D


Set factory2D1 = sketch1.OpenEdition()

Dim geometricElements1 As GeometricElements


Set geometricElements1 = sketch1.GeometricElements

Dim axis2D1 As GeometricElement


Set axis2D1 = geometricElements1.Item("AbsoluteAxis")

Dim line2D1 As CATBaseDispatch


Set line2D1 = axis2D1.GetItem("HDirection")
line2D1.ReportName = 1

Dim line2D2 As CATBaseDispatch


Set line2D2 = axis2D1.GetItem("VDirection")

line2D2.ReportName = 2

Dim circle2D1 As Circle2D


Set circle2D1 = factory2D1.CreateClosedCircle(0.000000, 0.000000, 24.214286)

Dim point2D1 As CATBaseDispatch


Set point2D1 = axis2D1.GetItem("Origin")

circle2D1.CenterPoint = point2D1

circle2D1.ReportName = 3

sketch1.CloseEdition

part1.InWorkObject = sketch1

part1.Update

End Sub

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy