×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem with Frame and Title block macro for counting parameters in CATIA drafting

Problem with Frame and Title block macro for counting parameters in CATIA drafting

Problem with Frame and Title block macro for counting parameters in CATIA drafting

(OP)
Hi.

I am trying to build a new macro for Frame and Title block for my company. I have been learning CATIA Scripting for 2 weeks. I want to insert some Parameters which will be later used for populating Title block. After I had defined desired parameters I encountered a problem with duplication of parameters for each new sheet. So I defined "If-Then" statement to prevent parameters` creation if parameters already exist, but it didn`t work. Parameters aren`t being created. If I delete If-Then statement parameters will be created. Does anyone have a solution for this kind of problem?
Here is part of my code:

Dim objParams As Parameters
Dim objParam As Parameter
Set objParams = CATIA.ActiveDocument.Parameters
If objParams.Count = 0 Then
Set objParam = DrwDocument.Parameters.CreateString ("Uradio", "M.Milasinovic")
Set objParam = DrwDocument.Parameters.CreateString ("Odobrio", "N.Jankovic")
Set objParam = DrwDocument.Parameters.CreateString ("Br.projekta", "V-20")
Set objParam = DrwDocument.Parameters.CreateString ("ID.projekta", "A2V0000")
Set objParam = DrwDocument.Parameters.CreateString ("Model", "RRX")
End If

Regards,

Marko!

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

try to look into DrawingDocument.Parameters.RootParameterSet.AllParameters

Eric N.
indocti discant et ament meminisse periti

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

(OP)
Thanks for answer. It`s working now.

Regards,

Marko!

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

(OP)
Hi,

I stucked again. This time I have problem with attribute linking string Parameter with Text. I tried with InsertVariable command, but with no luck.

Here is my code:
Dim objParams As Parameters
Dim objParam As Parameter
Set objParams = CATIA.ActiveDocument.Parameters
If DrwDocument.Parameters.RootParameterSet.AllParameters.Count = 0 Then
Set objParam = DrwDocument.Parameters.CreateString ("Uradio", "M.Milasinovic")
Set objParam = DrwDocument.Parameters.CreateString ("Odobrio", "N.Jankovic")
Set objParam = DrwDocument.Parameters.CreateString ("Br.projekta", "V-20/2395")
Set objParam = DrwDocument.Parameters.CreateString ("ID.projekta", "A2V0000")
Set objParam = DrwDocument.Parameters.CreateString ("Model", "RRX")
End If

Set Text = DrwTexts.Add("Text_05", OH-185+15+20+1, OV+55)
Text.InsertVariable 0,0,Uradio

Thanks in advantage!

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

(OP)
I resolved the problem by replasing last row with Text.InsertVariable 1, 3, DrwDocument.Parameters.Item("Uradio")

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

thanks for sharing the answer

Eric N.
indocti discant et ament meminisse periti

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

I just don't understand why don't you create user parameters in part or assy?

RE: Problem with Frame and Title block macro for counting parameters in CATIA drafting

(OP)
Well,

I did it because I wanted to save time for making same parameters for every project. In this way, the parameters can be used by the other colleagues and a script can be easily adjusted to have their names.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources