Question

My question is : how to use the view identifier as parameter?

Code example:

Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")
MyText.InsertVariable 0, 0, iParameter 

but how can i access to the view identifier, and use it as parameter?

thank you!

Was it helpful?

Solution

Ok, do do this you must first create a parameter in the DrawingDocument object.

So you would have something like this added to your current code:

Dim IndetifierParam as Parameter
Set IdentifierParam = MyDrawingDocument.Parameters.CreateString("ViewIdentifier", "A")
MyText.Text = "View ID:  "'note: there are two spaces from last character to end of the quote
MyText.InsertVariable Len(MyText.Text),0,IdentifierParam 'First parameter is insert position, second parameter is how many characters to overwrite, third is the parameter.

Now, in the drawing tree on the left you will see a Parameter Set with your new String Parameter. Double click the parameter and edit it...The drawing test will automatically update the drawing text with the changed parameter value. ALSO, as an added benefit, it's much easier in a VBA script to modify a parameter than the drawing text.

How to update or change this new Parameter:

IdentifierParam.ValuateFromString "A" 'add a string or variable here

Lastly, an extra tip, Go to Tools -> Options and click Parameters and Measure from the tree and on the First tab "Knowledge" check "With Value" and "With Formula" They are the first two checkboxes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top