×
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 Settings Using VBA

Change Settings Using VBA

Change Settings Using VBA

(OP)
How can I change the following setting using VBA?

Tools > Options > Mechanical Design > Sketcher > 'General Update Errors when the sketch is under-constrained'

I can do it manually. The recorded macro is blank. I could not find any reference to 'Sketcher' tab in the 'Setting Controller Reference in the help file. So I don't know which object and which property to use in the following statement:

CATIA.SettingsControllers.Item("WhichControllerObject").WhichProperty = False

It seems to me, changing settings using code is a tedious job. Is there easier way to find relevant information like above? Is there an easier / alternative way out?

Just an aside, curious to know if anybody knows the total number of settings in CATIA.

RE: Change Settings Using VBA

Hi NirVidP.

I am not good at English, so I wonder if it will be transmitted correctly.

The setting of 'General Update Errors when the sketch is under-constrained' can be switched by the following macro.
(There is no change on the option dialog.
However, the operation is switched.)

CODE --> vba

Sub CATMain()
    
    Dim setctl As SettingControllers
    Set setctl = CATIA.SettingControllers
    
    Dim setPpty As SettingRepository
    Set setPpty = setctl.Item("Sketcher")
    
    'General Update Errors when the sketch is under-constrained
    Dim attr As String
    attr = "DYS_settings_UnderDefUpdateErr"
    
    Dim prm As Variant
    prm = IIf(setPpty.GetAttr(attr), 0, 1)
    
    setPpty.PutAttr (attr), prm
    
    MsgBox ("Done")
    
End Sub 

>Is there easier way to find relevant information like above?
In 'Dumps Parameters values' of the options dialog
Dumping creates a catvbs file,
You can get hints for changing settings.

RE: Change Settings Using VBA

(OP)
Thank you but did not get the solution I wanted.
When I dump the settings for this tab. The .catvbs file is blank.
So, I really want to know how and from where did you find the value 'DYS_settings_UnderDefUpdateErr'. I was not able to find it in the help file either.

RE: Change Settings Using VBA

(OP)
Thank you ferdo, but I am aware of these resources. I posted because but I was not able to find the sketcher tab mentioned in the help.
In the options dialog - Mechnical Design > Sketcher > Sketcher
In the help table, I expected 'Sketcher' to be in the second column of the Mechanical Design solutions row. But it is not there. In fact I can't find the word 'Sketcher' on that page containing the table.

What am I missing?

Or not all the settings exposed?

RE: Change Settings Using VBA

>So, I really want to know how and from where did you find the value 'DYS_settings_UnderDefUpdateErr'.
I found it in a way to dump.
I do not know why your dump is blank.

RE: Change Settings Using VBA

(OP)
Thank you, ferdo, for the info.

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

eBook - Mastering Tolerances for Machined Parts
When making CNC machined parts, mastering tolerances can be challenging. Are general tolerances good enough? When does it make sense to call out for tighter tolerances? Do you need a better understanding of fits, datums, or GD&T? Learn about these topics and more in Xometry's new e-book. Download Now
eBook – How to Choose the Correct Corrosion Testing Method
When designing a metal component, engineers have to consider how susceptible certain alloys are to corrosion in the final product’s operating environment. In a recent study by NACE (National Association of Corrosion Engineers), it was estimated that the direct and indirect costs of corrosion in the United States is approximately 6.2% of the GDP. In 2016, that cost exceeded $1 trillion dollars for the first time. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close