Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Scripts with arguments 1

Status
Not open for further replies.

eduardopinto07

Automotive
Feb 28, 2014
20
Hello colleagues! I am trying to call a VB Script with argument from another VB Script with argument. Is it possible??
Please see attached images.

Create a Product with a Reaction and 2 VB Scripts with Arguments.
Tree_yzfej8.jpg


Create a Part
part1_wyxxn7.jpg


Inside the reaction select the Product1 as Source and Insert as Event. Insert The previously created Part (Part1.2-Instance Name)
Reaction_kuelwx.jpg


VB Script.2 will send a msg
Message_from_VB_Script.2_qli7rg.jpg


will Call TEST(Here is where I am not sure if it is possible)
VB_Script.2_wjixpo.jpg


error received
Erro_Message_when_trying_to_Call_TEST_l2vamn.jpg


The Call send the message "sdgsdgsfgsgfsag"
VB_Script.4_hyje47.jpg


procedure_ohskr0.jpg


The goal is to have the message box showing "sdgsdgsfgsgfsag" at the end of the process.

Any reply will be much appreciated!

Thank you for your support!

Eduardo Pinto
 
Replies continue below

Recommended for you

one possible work-around (I couldn't find any direct way of accessing the scripts within the script node in CATIA tree...):
Since we know that reactions work for your case, create a parameter (its value change will trigger a reaction that calls on your second script...)
and change it's value in the first script.
to control the parameter located in the assy, use syntax similar to this:
CATIA.ActiveDocument.Product.Parameters.RootParameterSet.DirectParameters.item("RunOtherScript").Value = "True"
my RunOtherScript parameter is a Boolean


2023-08-31_10-07-25_bpujx1.gif


regards,
LWolf
 
Hi LWolf,

Thanks a lot for your reply, always appreciated!
I understand your workaround, thank you for taking the time and trying it out.
The little assy that I sent as example is just a trial piece of what I am really trying to do...
Today I have Some reactions using VB action inside different assemblies under my Root assembly. I have around 300 line of code inside each Reaction (Total around 1200 line). I want to separate them in small pieces to better manage them and to be easier to debug if something goes wrong.
What I really wanted to do is to Run() a VB Script, set the global variables (Or send the arguments) from one VB Script to another and error handling each VB Script piece separate, like we do using VBA and Modules and Forms...
This is the reason to try to find out if the call works or not from the VB Script...I know I can copy the code and run from a file, but I wanted to keep all the code inside the assemblies to be better to deploy as a Template (Only Catia files, no TXT, No Excel, etc...)

Thank you, a lot, for your support! I will keep searching! If I find anything, even bad news, I will let you know!

Eduardo Pinto
 
Do not use reactions as code modules.

Put code in different .CATScripts and call them with SystemService.Exec() instead. Or host shared code as WSC component.
 
Hi Little Cthulhu,
Thanks a lot for your reply, always appreciated!
I have a reaction that is triggered by the Insert Event in an assembly and inside the reaction I use VB Action. This Reaction auto position the parts that I inserted (Coincidence Constraint) - It is working fine for the last 2 years.
I also have another reaction that is triggered by the update event and this reaction transfer parameter values from all kinds of different parts/parameters from the parts to the skeleton and from the skeleton to the parts every time an update is triggered in the assembly context. This is to ensure if someone changed manually the parameters in the skeleton, the reaction will overwrite the correct values from the parts - It is working fine for the last 2 years.

The problem is that the number of parameters that are being transferred from the skeleton to the parts and from the standard parts to the skeleton have increased exponentially in the past year. We started with 8 parameters and now we have around 200. We improved the models but now we have a lot of different templates around, from the old one to the brand new ones....I want to modify the way I have the scripts inside the reactions to have the automation like a LEGO...If we need another NEW part to be added or an old part to be modified, will be easier to identify where it is and which pieces we need to add...today it is all mixed inside the reaction.

Regarding your comments, could you please elaborate more on that? Is this going to work using VB Scripts with Arguments and reactions from KWA/KAE advisor?

Thank you for your time and support.

Eduardo Pinto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor