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

Pa Meters

The document describes VBSCRIPT code that is used to programmatically modify properties of a CATIA part document. It sets string, dimension, and reference properties on the part including name, density, mass, volume, detail reference, description, material, and custom properties. It then loops through all parts in the product, applies design mode, and accesses thickness, material, mass and other property values to check if they match the real part number.

Uploaded by

magerote
Copyright
© Attribution Non-Commercial (BY-NC)
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)
248 views3 pages

Pa Meters

The document describes VBSCRIPT code that is used to programmatically modify properties of a CATIA part document. It sets string, dimension, and reference properties on the part including name, density, mass, volume, detail reference, description, material, and custom properties. It then loops through all parts in the product, applies design mode, and accesses thickness, material, mass and other property values to check if they match the real part number.

Uploaded by

magerote
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

Language="VBSCRIPT" Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set relations1 = part1.Relations Set parameters1 = part1.

Parameters Set strParam1 = parameters1.CreateString("NOME", "") Set parameters2 = part1.Parameters Set dimension1 = parameters2.CreateDimension("DENSIDADE", "DENSITY", 0.000000) Set parameters3 = part1.Parameters Set dimension2 = parameters3.CreateDimension("MASSA", "MASS", 0.000000) Set parameters4 = part1.Parameters Set dimension3 = parameters4.CreateDimension("VOLUME", "VOLUME", 0.000000) part1.Update End Sub

Language="VBSCRIPT" Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set product1 = partDocument1.Product Set parameters1 = product1.UserRefProperties Set strParam1 = parameters1.Item("Detail") strParam1.Value = "513" Set strParam2 = parameters1.Item("Description") strParam2.Value = "Burnout - see drawing" Set strParam3 = parameters1.Item("Material") strParam3.Value = "HRS" Set strParam4 = parameters1.CreateString("Use_of_Detail", "") strParam4.Value = "Some value..." End Sub

getNEWID = myParameters.Item(part1.Name & \Properties\NEW_ID ).ValueAsString This same code can be used to access thickness, material, mass, and more. begin complete code script by Emmett Ross, www.scripting4v5.com Sub CATMain() Dim productDocument1 As Document Dim product1 As Product Dim products1 As Products Set productDocument1 = CATIA.ActiveDocument Set product1 = productDocument1.Product Set products1 = product1.Products count the number of CATParts partcount=product1.Products.Count msgbox CHECK: The number of parts is &partcount& . Please click OK to continue. loop through all parts Dim i As Integer For i=1 to partcount apply design mode products1.Item(i).ApplyWorkMode DESIGN_MODE Dim partDoc1 As PartDocument Set partDoc1=products1.Item(i) namebody=partDoc1.name Dim partDoc2 As PartDocument Set partDoc2 = partdoc1.GetMasterShapeRepresentation(True) Dim part1 as Part Set part1 = partDoc2.Part Dim myProduct As Product Set myProduct = productDocument1.GetItem(part1.Name) Dim myParameters As Parameters Set myParameters = myProduct.UserRefProperties Dim getThickness,getMaterial, getMass, nom, partName, RealPartNumber As String getThickness = myParameters.Item(part1.Name & \Properties\Thickness ).ValueAsString getMaterial = myParameters.Item(part1.Name& \Properties\Material ).ValueAsString getMass = myParameters.Item(part1.Name & \Properties\Mass ).ValueAsString getNEWID = myParameters.Item(part1.Name & \Properties\NEW_ID ).ValueAsString nom=myProduct.Nomenclature partName=myProduct.name Defy=myProduct.Definition RealPartNumber=myProduct.PartNumber If getNEWID = RealPartNumber Then Msgbox PartNumber is: & RealPartNumber & vbNewLine & NEW_ID is: &_ getSTID & vbNew Line & They are a MATCH. Else Msgbox PartNumber is: & RealPartNumber & vbNewLine & NEW_ID is: &_ getNEWID & vbNe

wLine & End IF Next i End Sub

They are NOT a match.

'then reset the properties using CATIA.StartCommand "Reset Properties"

You might also like