Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.


Forum Highlight: CATIA V6

 

Get Answers to Your V6 Questions
Dassault Systèmes answers user questions about CATIA V6.  Discuss these answers and propose new questions with end users from around the world in the CATIA V6 Forum.

COE DISCUSSION FORUM
Subject: VBScript in KWE/KWA Rules

You are not authorized to post a reply.   
Author Messages
DAVE2784


07 May 2007 09:06 AM

In KWE or KWA rules, it is possible to create objects such as points, planes, lines, etc. on the fly.  I have been trying to create a VB Script on the fly within a rule in this way and was wondering if anyone else has ever tried this?

There are two types available in the KWA rule language browser: "VBScript" and "kweVBScript".  VBScript has three attributes: "ScriptText", "EntryPoint" and "Arguments".  I have been able to use these attributes to populate/modify a "Macros with objects" (VBScript) on the tree, but have not been able to use it to generate a VBScript on the fly.  When I go to use the ->Run function, it fails.

I think the problem is, there is no function to create the VBScript object, so the attributes in the language browser can only be used to modify something that has already been created.  Conversely when dealing with a point, line, etc. there are functions that actually create an object.

My reason for doing this is I am trying to execute a script in a KWE advanced check without having the user click the "corrective action" icon; I want it to happen automatically.  I also want my solution to be contained in one file, so no references to external scripts are needed.

At this point, I’m just fishing for clues so any input would be appreciated.  I have included a screenshot of the language browser with the two types described above.






DS_DEVELOPER

11 May 2007 03:26 AM
Hello,

why do you try to create the script on the fly?

In my opinion, there are several ways to do what you want to:
- use Knowledge Patterns to create the geometry (CreateOrModifyDatum). The pattern execution can be controlled within your rule and depend on external parameters to fit required specifications
- use InstantiateTemplate function to instantiate a power copy that contains wanted geometry. The power copies can be defined in the same document.

About the two script types, it is a bug we know (but that is quite difficult to solve for obscure reasons) : some objects expose two different types and only one is really usable. In this case, I think you have to use VBScipt type to modify an existing script and use the other type to run it! Ugly...

Regards
DAVE2784


14 May 2007 07:07 AM
My goal is not to generate geometry with a script, I want to access the file system and create/append a .txt or .xls file.

I would prefer to just use the report functionallity that is already built into CATIA but I can only pass objects to "AddTupleFailed" or "AddTupleSucceeded" and I want to pass a string parameter.

Im using the report to count how many power copies exist in a part based on a flag embedded in the power copy. The report needs to output the name of the power copy and I want to use the string parameter (flag) to report this name. I currently am dynamically changing the name of the body and passing that to the report, but I would rather just pass the value of the string parameter to the report.
You are not authorized to post a reply.
Forums > COE Forums > KBE > VBScript in KWE/KWA Rules



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)