×
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

Change a Parameter into a ParameterSet using a MACRO

Change a Parameter into a ParameterSet using a MACRO

Change a Parameter into a ParameterSet using a MACRO

(OP)
Good morning,

I am trying to change a parameter from a ParameterSet recording a Macro.

Attached is a screenshot of the location of the parameter "b", the one to change, and the macro script.

I am not sure about what is happening in the script, and why it does not achieve the parameter "b".

The Macro works when I try to change a parameter out of the ParameterSet.

Do you know how can I make it work????? ponder


Thank you very much!!

RE: Change a Parameter into a ParameterSet using a MACRO

Try this from VBA code.

CODE --> CATVBA

Dim partDoc As PartDocument
    
    Set partDoc = CATIA.ActiveDocument
    
    Dim SubParamSet As ParameterSet
    
    Set SubParamSet = partDoc.Part.Parameters.RootParameterSet.ParameterSets.GetItem("SubParameterSet")
    
    Dim oParameter As Parameter
    
    Set oParameter = SubParamSet.AllParameters.GetItem("ParameterInSubParameterSet")
    
    MsgBox (oParameter.ValueAsString) 



Eric N.
indocti discant et ament meminisse periti

RE: Change a Parameter into a ParameterSet using a MACRO

(OP)
Thank you very much itsmyjob!!!

This is the VBS code I´ve use:

Language="VBSCRIPT"

Sub CATMain()

Set partDocument1 = CATIA.ActiveDocument

Set part1 = partDocument1.Part

Set parameters1 = part1.Parameters

Set parameterSet1 = parameters1.RootParameterSet

Set parameterSets1 = parameterSet1.ParameterSets

Set parameterSet2 = parameterSets1.GetItem("SubParameterSet")

Set parameter=parameterSet2.AllParameters

Set parametertochange=parameter.GetItem("ParameterInSubParameterSet")

Set lenght1=parametertochange

lenght1.Value=35.000

part1.Update

End Sub

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