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 CATIA] identifier of view as parameter

Status
Not open for further replies.

sigmacoder

Mechanical
Mar 16, 2013
30
MA
Hi,

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

For example :

Code:
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set [COLOR=#EF2929]iParameter[/color] = 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!
 
Replies continue below

Recommended for you

Try with this..
Code:
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")
[highlight #EF2929]Call [/highlight] MyText.InsertVariable [highlight #EF2929]([/highlight] 0, 0, iParameter [highlight #EF2929])[/highlight]
 
but.. if you want to put the scale on text..

use something like this

Code:
Call MyDrawingView.InsertViewScale(1 + Len(MyText.Text), MyText)

"MyText" is the text you want to insert the scale

"1 + Len(MyText.Text)" is the first character from which the parameter is inserted
 
if you want to use a parameter you can use something like this ..

Code:
    Dim MyDoc As Document
    Set MyDoc = CATIA.ActiveDocument

    Dim MyDrawingDoc' As DrawingDocument
    Set MyDrawingDoc = MyDoc

Call MyText.InsertVariable(1, 0, MyDrawingDoc.Parameters.GetItem("Dwg#"))

"Dwg#" is the name of the parameter you want
 
ferdo:
imagine this scenario: if i add some caracters to the callout text "A" of the cut section for example, change it to "A12", and after that i try to change the name of the view "A-A", the callout text will not change, and it's a big problem!

one solution is to use:
Code:
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("[COLOR=#EF2929]Sheet.1\A-A\ViewName.1\ident[/color]")
calloutText.InsertVariable 0, 0, iParameter

but this code doesn't work i dont know why...

AlexLozoya: thank you, but i want to use this parameter : Sheet.1\A-A\ViewName.1\ident

and it doesn't work ... can i serach it o something else ?

thank you
 
anyone know how to use :
Code:
String = "String to insert after"
MyTextRange.InsertAfter(String)

to answer caracters after the callout?(see response above)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top