![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: problem with current module Topic Summary: current module not set if module already open Created On: 18-Jun-2007 11:46 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Tony, Thanks for the reply. I knew about the difference between ModName_ and Module reference, but was expecting DOORS to keep track of 'current', which on reflection was unreasonable. Presumably 'current' applies up the hierarchy in the sense that if an object is current in a module, the module is current as is the folder and project that contains it. Working the other way, DOORS cannot guess which module is current when several could be open. I hadn't realised that read(modname, bool) could be used to make the named module current without changing the edit mode. Thanks again Jim | |
![]() |
|
I've recently done the DOORS DXL course but still struggling with some issues.
I've written a script to report on the attributes and types used in a module which works as expected apart from a few lines at the start that are supposed to check if a module is open and conditionally open it. The problem is that if the module is already open, 'current' is not set. I'm trying to run the code from the DXL interaction window at the database level. It may work OK if I run from the module's DXL interaction window. Code attached ------------------------- Jim Backus<BR>Ultra Electronics, Controls |
|
![]() |
|
![]() |
|
You are confusing the Module type handle with the ModName_ handle.
Any way, you only care if the module is open when you are tidying up by closing them. Use read(modname, false) to open the module which gives you a good handle on the module whether it was open or not. See the attached. ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
[1] Attached is my fIsOpen function. I routinely use this in scripts that open lots of modules figuring the script will close the module unless its already open. I use the overloaded bool function (2nd function attached).
for NameModFull in the folder and below { IsOpen = fIsOpen(NameModFull, false) mod = read(NameModFull, false) deal with mod if (!IsOpen) close(mod, false) } [2] Your original script makes use of 'current' module. That makes sense only when running from an open module: Module mCurr = current if (null mCurr) {infoBox("Run from open module"); halt} Since your script is intended to run from the explorer, there is no reason to consider the notion of a current module. Note: in Versions past, opening a module changed the 'current' module. That creates havok with scripts that use functions that presume current module; most attribute def and type functions presume current module. To resolve that, I routinely insert the following above such commands: current = mCurr This makes sure I know which module is current. I don't know if the new versions of DOORS changes the current module when you open one; but my scripts are bullet proof to that now. - Louie |
|
![]() |
|
![]() |
|
Tony,
Thanks for the reply. I knew about the difference between ModName_ and Module reference, but was expecting DOORS to keep track of 'current', which on reflection was unreasonable. Presumably 'current' applies up the hierarchy in the sense that if an object is current in a module, the module is current as is the folder and project that contains it. Working the other way, DOORS cannot guess which module is current when several could be open. I hadn't realised that read(modname, bool) could be used to make the named module current without changing the edit mode. Thanks again Jim ------------------------- Jim Backus<BR>Ultra Electronics, Controls |
|
![]() |
|
![]() |
|
quote: Yes it does. When you open a module in a DXL script, the current module is changed to that newly opened module. So if you need the current module to be the module you are running the script from, you must reassign it to be the current module. If you didn't get a handle on the module you're running the script from before opening another module, then you won't be able to without code similar to louie's. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
... maybe the old DOORS would change current even when you open a module that was already open, but the new DOORS only changes current when the module wasn't already open.....
Anyway, for scripts that work on the current module, I see no way around not having something like this at the top: Module mCurr = current if (null mCurr) {infoBox("Run from open module"); halt} That makes sure the script is running from an open module, and keeps a handle on that module which surely will be used elsewhere. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
problem with current module
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.