CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 15 votes, 5.00 average. Display Modes
  #1  
Old 02-23-2011, 03:02 PM
brent.g brent.g is offline
Registered User
 
Join Date: May 2010
Posts: 20
Loading model based on SEL_ITEM

Hello everyone,

I am currently working on some code that involves tracking down parts that are the owners of views and determining if they are loaded or not. This part is already done. What I am looking to do is modify the code such that if a part is NOT loaded, then it will be automatically loaded from the database.

Currently the owner is found with:

PHP Code:
display(first (oli::sd-am-inq-all-3d-owners)) ; returns first in list no problem 
(In our company it is okay to assume all drawings have the same owner)

Next, we check to see if the part is loaded

PHP Code:
display(oli::sel_item-p(second (first (oli::sd-am-inq-all-3d-owners)))) ; this part works fine, if T then part is loaded in sd, if NIL part is not loaded 
(I am straying from using variables so that people reading this can use the code right off from annotation)

Now I know it is possible to load a part if you have an identifier or an elid, for example:

PHP Code:
(oli::sd-db-element-load :identifier "650-11362" :database-type :model
My question is if it is possible to load an element from the same information which is collected for determining if the part is currently loaded. For example I tried (don't laugh):

PHP Code:
display (oli:sd-db-element-exists :identifier (second (first (oli::sd-am-inq-all-3d-owners)))) 
This doesn't work, but this is the idea. The identifier as I understand is the name of the part in the database. I do know how to get the name of the view:

PHP Code:
display(oli::sd-am-inq-name(first (first (oli::sd-am-inq-all-3d-owners)))) ;;currently returns name 
But not the name of the part, so if someone knows how to do this bit, it could work.

Anyway, I will quit typing and see if someone knows how to help. If any of this is confusing feel free to ask and I can elaborate.

Thanks,

Brent
Reply With Quote
  #2  
Old 02-25-2011, 08:57 AM
brent.g brent.g is offline
Registered User
 
Join Date: May 2010
Posts: 20
Re: Loading model based on SEL_ITEM

Alright, so I think I am getting close here. I am still having an issue with just one message (see attachment)

The following works when the part is loaded:

PHP Code:
display(oli::sd-inq-obj-sysid (second (first (oli::sd-am-inq-all-3d-owners))))
 
returns 969500-1298388487-2564b217ac-0 14266
 
display
(oli::sd-db-element-elid (second (first (oli::sd-am-inq-all-3d-owners)))) 
 
returns CARP8R2XC8G2F0 when part is loaded 
Now if the part is not loaded, the previous two lines return the lisp error "969500......14266 is not a structure" (see image) I know that the sysid can be found when the part is not loaded:

PHP Code:
display(second (first (oli::sd-am-inq-all-3d-owners)))
 
969500-1298388487-2564b217ac-0 14266 is what gets returned if the part is not loaded 
But why am I getting this "not a structure" error? Why can't I use this sysid with the database (model manager) to get more information? Does anyone know of a way to call to the database with a sysid and get any kind of information back when the part is not currently loaded?

Any insight is appreciated,

Brent
Attached Thumbnails
Click image for larger version

Name:	errormessage.jpg
Views:	295
Size:	145.3 KB
ID:	1784  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:12 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
You Rated this Thread: