0% found this document useful (0 votes)
64 views3 pages

Yash M. Zirale B 131 T.Y.Btech

The document contains VBSCRIPT code that creates a 2D sketch in CATIA. It defines points, lines, and constraints in the sketch such as horizontal, vertical, and length constraints. It then closes the sketch edition and updates the part.

Uploaded by

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

Yash M. Zirale B 131 T.Y.Btech

The document contains VBSCRIPT code that creates a 2D sketch in CATIA. It defines points, lines, and constraints in the sketch such as horizontal, vertical, and length constraints. It then closes the sketch edition and updates the part.

Uploaded by

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

Yash M.

Zirale

B 131

T.Y.Btech

Language="VBSCRIPT" part1.InWorkObject = sketch1

Sub CATMain() Set factory2D1 = sketch1.OpenEdition()

Set partDocument1 = CATIA.ActiveDocument Set geometricElements1 =


sketch1.GeometricElements
Set part1 = partDocument1.Part
Set axis2D1 =
Set bodies1 = part1.Bodies geometricElements1.Item("AbsoluteAxis")
Set body1 = bodies1.Item("PartBody") Set line2D1 = axis2D1.GetItem("HDirection")
Set sketches1 = body1.Sketches line2D1.ReportName = 1
Set originElements1 = part1.OriginElements Set line2D2 = axis2D1.GetItem("VDirection")
Set reference1 = originElements1.PlaneXY line2D2.ReportName = 2
Set sketch1 = sketches1.Add(reference1) Set point2D1 =
Dim arrayOfVariantOfDouble1(8) factory2D1.CreatePoint(0.000000, 45.000000)

arrayOfVariantOfDouble1(0) = 0.000000 point2D1.ReportName = 3

arrayOfVariantOfDouble1(1) = 0.000000 Set constraints1 = sketch1.Constraints

arrayOfVariantOfDouble1(2) = 0.000000 Set reference2 =


part1.CreateReferenceFromObject(point2D1)
arrayOfVariantOfDouble1(3) = 1.000000
Set reference3 =
arrayOfVariantOfDouble1(4) = 0.000000 part1.CreateReferenceFromObject(line2D2)

arrayOfVariantOfDouble1(5) = 0.000000 Set constraint1 =


constraints1.AddBiEltCst(catCstTypeOn,
arrayOfVariantOfDouble1(6) = 0.000000
reference2, reference3)
arrayOfVariantOfDouble1(7) = 1.000000
constraint1.Mode =
arrayOfVariantOfDouble1(8) = 0.000000 catCstModeDrivingDimension

sketch1.SetAbsoluteAxisData Set point2D2 =


arrayOfVariantOfDouble1 factory2D1.CreatePoint(55.000000, 45.000000)
point2D2.ReportName = 4 Set reference4 =
part1.CreateReferenceFromObject(line2D3)
Set line2D3 = factory2D1.CreateLine(0.000000,
45.000000, 55.000000, 45.000000) Set reference5 =
part1.CreateReferenceFromObject(line2D1)
line2D3.ReportName = 5
Set constraint2 =
line2D3.StartPoint = point2D1 constraints1.AddBiEltCst(catCstTypeHorizontalit
line2D3.EndPoint = point2D2 y, reference4, reference5)

Set point2D3 = constraint2.Mode =


factory2D1.CreatePoint(55.000000, 0.000000) catCstModeDrivingDimension

point2D3.ReportName = 6 Set reference6 =


part1.CreateReferenceFromObject(line2D5)
Set line2D4 = factory2D1.CreateLine(55.000000,
45.000000, 55.000000, -0.000000) Set reference7 =
part1.CreateReferenceFromObject(line2D1)
line2D4.ReportName = 7
Set constraint3 =
line2D4.EndPoint = point2D2 constraints1.AddBiEltCst(catCstTypeHorizontalit
y, reference6, reference7)
line2D4.StartPoint = point2D3
constraint3.Mode =
Set point2D4 =
catCstModeDrivingDimension
factory2D1.CreatePoint(0.000000, 0.000000)
Set reference8 =
point2D4.ReportName = 8
part1.CreateReferenceFromObject(line2D4)
Set line2D5 = factory2D1.CreateLine(55.000000,
Set reference9 =
0.000000, 0.000000, 0.000000)
part1.CreateReferenceFromObject(line2D2)
line2D5.ReportName = 9
Set constraint4 =
line2D5.StartPoint = point2D3 constraints1.AddBiEltCst(catCstTypeVerticality,
reference8, reference9)
line2D5.EndPoint = point2D4
constraint4.Mode =
Set line2D6 = factory2D1.CreateLine(0.000000, catCstModeDrivingDimension
0.000000, 0.000000, 45.000000)
Set reference10 =
line2D6.ReportName = 10 part1.CreateReferenceFromObject(line2D6)

line2D6.EndPoint = point2D4 Set reference11 =


part1.CreateReferenceFromObject(line2D2)
line2D6.StartPoint = point2D1
Set constraint5 = sketch1.CloseEdition
constraints1.AddBiEltCst(catCstTypeVerticality,
reference10, reference11) part1.InWorkObject = sketch1

constraint5.Mode = part1.Update
catCstModeDrivingDimension Set shapeFactory1 = part1.ShapeFactory
Set reference12 = part1.Update
part1.CreateReferenceFromObject(point2D3)
End Sub
Set reference13 =
part1.CreateReferenceFromObject(line2D1)

Set constraint6 =
constraints1.AddBiEltCst(catCstTypeOn,
reference12, reference13)

constraint6.Mode =
catCstModeDrivingDimension

Set reference14 =
part1.CreateReferenceFromObject(line2D4)

Set constraint7 =
constraints1.AddMonoEltCst(catCstTypeLength,
reference14)

constraint7.Mode =
catCstModeDrivingDimension

Set length1 = constraint7.Dimension

length1.Value = 45.000000

Set reference15 =
part1.CreateReferenceFromObject(line2D3)

Set constraint8 =
constraints1.AddMonoEltCst(catCstTypeLength,
reference15)

constraint8.Mode =
catCstModeDrivingDimension

Set length2 = constraint8.Dimension

length2.Value = 55.000000

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