- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-19-2011 12:55 PM
Hello all:
I am building a set of BODYs programmatically using C++, adding them to an ENTITY_LIST, which I then save to a SAT file. I would like to be able to give a unique name (and perhaps some other attirbutes) to each of these BODYs. I will appreciate it if any one could kindly share a C++ example with me.
Thanks a lot for your cooperation, and have a great afternoon.
Diaa ElKott
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-19-2011 01:03 PM
Hi Diaa
The easiest way to do this is to use generic attributes. Probably the first two things you may want to do are: 1) attaching names to entities and 2) querying the names from entities. These things can be accomplished using
api_add_generic_named_attribute
and
api_find_named_attribute.
The main complexity in using these APIs is deciding what propagation behavior you want for the names and other data you attach. Please see http://doc.spatial.com/index.php/Tutorial:ACIS_Tut
I hope this helps somewhat.
Eric
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-20-2011 08:05 AM
Hello Eric:
Many thanks for your response. I will go over the tutorials, and hopefully will be able to achieve my goal.
Have a wonderful day.
Diaa ElKott
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-21-2011 08:21 AM
Hello again, Eric:
I followed your recommendations, and was able to add names to BODYs. I opened the saved SAT file to ensure that these names were included, and they were. Thanks for your tip with that regard. The new issue that rose is that I lose these names when I load the SAT file using the (part:load) Scheme command. Is there an alternative way which would help me load the model, and preserve the names of the models which are stored within it?
Thanks, and have a great day.
Diaa ElKott
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-21-2011 12:15 PM
Hello again,
I asked Yogesh about this and he mentioned that generic attributes should be loadable in scheme and provided the following example where this, in fact, occurs
(part:clear)
(define block1 (solid:block (position 0 0 0)(position 5 10 15)))
(generic:add block1 "layer" “MyLayerXYZ”)
(generic:get block1 “layer”)
(part:save “c:\\temp\\a.sat”)
(part:clear)
(part:load “c:\\temp\\a.sat”)
(define block2 (car (part:entities)))
(generic:get block2 “layer”)
It is possible that looking at the example will help you get the scheme syntax right. If not, there may be something special about the situation you are dealing with, in which case you may want to contact customer support or post more information here.
thanks
Eric
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-21-2011 01:51 PM
Hello Eric:
Thanks for your response, and the Scheme code. The issue at hand is as follows:
- I built several BODYs using "api_sweep_with_options()".
- Added a name attribute to each body using "api_add_generic_named_attribute()".
- Added these bodies to an ENTITY_LIST.
- Saved the ENTITY_LIST to a SAT file.
- I attempt to load the SAT file using the (part:load) Scheme command.
- I interrogate the part using the (display (attrib:get (car (part:entities)))) command.
- I get "()" as a result.
As a test, please find attached the SAT file which I am attempting to interrogate. This file includes five entities, one of which is named "SamplePartName".
Thanks again for your help.
Diaa ElKott
Re: Assigning names to entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-21-2011 01:56 PM
Pls try (generic:get (entity 1) "SamplePartName")
It will return Found ()
Regards,
Yogesh
Re: Assigning names to entities
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-25-2011 08:46 AM - last edited on 04-25-2011 02:38 PM
Hello Yogesh:
Thanks a lot for your input. I used this command, and it worked exactly as you described. After some further reading, I think I probably should use the Assembly API to build my model.
Thanks again for all your help.
Diaa ElKott

