View Full Version : How to save the elements of INQ_SELECTED_ELEM?
Lim Chee Beng
05-08-2003, 05:52 PM
I'm wondering whether there is a effective method to save the result of INQ_SELECTED_ELEM before issueing another INQ_SELECTED_ELEM command.
This is particularly useful when I have to deal with multiple sets of INQ_SELECTED_ELEM at the same time, and I don't want to lose the balanced elements in memory after couple of INQ_NEXT_ELEM. I wish I can recall immediately the balanced elements into memory for subsequent process anytime when I need them.
:)
Thom Ivancso
05-09-2003, 12:10 PM
You might want to look into writing the selected elements into a file and then extracting the information from the files as needed using the following commands
OPEN_OUTFILE
OPEN_INFILE
READ_FILE
WRITE_FILE
CLOSE_FILE
Or you could use the STORE_IN_RECALL_BUFFER and the RECALL_BUFFER commands.
Since I do not know the exact application of the macro you are writing this is the best information I can point you at.
Lim Chee Beng
05-12-2003, 03:23 AM
Thx. This seems to be one of solution.
My problem is roughly as below.
{---Begin----------------------------------------------}
INQ_SELECTED_ELEM INFOS 'xxxx' END
{Let say elements A,B and C selected}
..........{other operations}
INQ_NEXT_ELEM {Then, only elements B and C left}
{At this point, is it possible to save the 'id' of elements B and C??}
{I wish I can recall the elements B and C later by the 'id'}
INQ_SELECTED_ELEM INFOS 'yyyy' END
{Another set of elements selected}
..........{other operations}
{At this point, can I recall elements B and C after the operations by 'id'??}
{---END------------------------------------------------}
For part, there are part name (INQ_ENV 7, INQ 301) and unique name (INQ_ENV 7, INQ 302). The question here is, is there a unique id for each element in OSDD can be utilized for save and recall purposes?
To make my question simpler, if I use INQ_SELECTED_ELEM INFOS 'xxxx' END to select elements A, B and C. Can I delete programatically the first element in by entering DELETE and followed by (INQ ??) to tell OSDD deleting first element?
ChrisE
05-12-2003, 08:01 AM
You might want to attach a temporary INFO string to your elements B and C (by attaching it element by element in a loop), then submit your second select, and then later refer to your elements B and C by a third select using the temporary info strings.
The macro level won't give you the model pointers to the elements - this would require programming in the C-API. All you retrieve is a "pick" point where the main vertex of the element resides. A weak solution, but that's how it was implemented a long time ago.
Wolfgang
05-13-2003, 12:53 PM
Which version of 2DD are you using?
I'm not sure in which version it's supported (if at all....)
INQ_SELECTED_ELEM GLOBAL INFOS 'whatever*'
WHILE ((INQ 14) > 0)
LET Address (INQ 2)
WRITE_LTAB .... Address...
END_WHILE
the adress is a kind of pointer and unique
then you can run through your outer loop by working on the LTAB.
INQ_SELECTED_ELEM GLOBAL Address .....
Lim Chee Beng
05-14-2003, 03:54 PM
That's strange, I'm using version 2002+ (Rel.11.60b). (INQ 2) is not seen in help file.
I tried (INQ 2) and it does respond with a 9-digit integer and seem to be unique for each element. But, I can't select back the element using INQ_NEXT_ELEM plus the pointer of element, error beep is given by OSDD. Is there any hidden setting or trick? Can you delete the first element by entering DELETE (INQ 2)? Really interested to learn.....
BTW, thanks, Chris. I take the idea of Chris to resolve the problem temporarily, assuming the sequence of elements selected by INQ_SELECTED_ELEM INFO 'xxxx' are always in same order. Are they?
ChrisE
05-15-2003, 04:00 AM
Originally posted by Lim Chee Beng
... assuming the sequence of elements selected by INQ_SELECTED_ELEM INFO 'xxxx' are always in same order. Are they? ...
I wouldn't rely on it.
So if you need to keep the order of your first inq_selected_element, then you could attach numbered info strings to your elements (the first element receives "TMP_1", the second "TMP_2"), and then run a loop and inquire them one after the other : INQ_SELECTED_ELEM INFOS "TMP_1", and so on.
ChrisE
05-15-2003, 04:04 AM
Originally posted by Wolfgang
the adress is a kind of pointer and unique
Wolfgang, how long is this model pointer valid???
When you e.g. delete elements, or do some drawing operations, would they still be valid?
The "sel_item" in OSD is sometimes still valid after modeling operations, but I rather attach infos strings (attributes) to the elements I'm interested in, and then try to find them via the attributes later.
Chris
Lim Chee Beng
05-15-2003, 05:48 PM
Yes, the element pointer works in Version 2002+. This is a great but hidden feature. To select the element by its pointer, I have to key in 'POINTER' qualifier first followed by the pointer address.
Pointer can also be used with DELETE command but I'm aware that (INQ 14) is not decremented after element being deleted.
Thanks, Wolfgang.
:p
Wolfgang
05-18-2003, 05:48 AM
(INQ 2) is not seen in help file.unsupported
the sequence of elements selected by INQ_SELECTED_ELEM INFO 'xxxx'. Are they? I say it more strong than Chris: Do not rely on it!!!
The pointer is valid as long as the element exists AFAIK. I assume you'll get a signal when trying to access an element by pointer which was deleted between INQ and access.
Of course INQ 14 is never decremented when you delete an element, regardless which way you did the selection. INQ 14 is only dealing with the elements that you did select within the select command. (building up a list (as a snapshot) and running through that list)
Yes, the POINTER keyword will give you the possibility to reselect that element. Sometimes it's needed to use the SELECT POINTER... instead of a direct POINTER command. Annotation is using 'POINTER' quite a lot.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.