Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Change Settings Using VBA

Status
Not open for further replies.

NirVidP

Industrial
May 10, 2010
45
0
0
IN
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.
 
Replies continue below

Recommended for you

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:
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.

setting_param_fyahao.png
 
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.
 
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?
 
>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.
 
Status
Not open for further replies.
Back
Top