cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

sd-inq-part-density

ThomasKirkman
16-Pearl

sd-inq-part-density

The sd-inq-part-density command can be modified to find the density of the contents, instance or realized.  However; I cannot get the kind option to work.  

 

I added this to a lisp

(sd-inq-part-density part (kind :contents))

 

but this does not work.  With out the (kind :contents) it works find.

 

Any suggestions?

 

Below is copied from the help in Version 19.1.

 

(sd-inq-part-density part &optional (kind :realized))
Description:
Returns density of the specified part. Kind determines the kind of density you want to inquire (attached to contents, attached to instance or the one realized).

 

Parameters:
part {SEL_ITEM}
kind (optional) one of
:contents - inquire the base density (attached to contents; may be nil)
:instance - inquire the part density (attached to instance; may be nil)
:realized - inquire the realized density (i.e. the one used when realizing the part)

 

Return Value:
density {LONG-FLOAT}
nil - if the inquired kind of density isn't specified (:contents / :instance only)

 

See Also:
SET_PART_BASE_DENSITY   [terminate action]
SET_PART_INST_DENSITY   [terminate action]

 

(Note: SET_PART_DENSITY   [terminate action] is going to be obsolete)
Creo Element\Direct Modeling 20.6.0.0.0
1 ACCEPTED SOLUTION

Accepted Solutions
PeterKehoe
5-Regular Member
(To:ThomasKirkman)

This is what I typed in on my command line which worked:

 

(display (oli:sd-inq-part-density (oli:sd-inq-curr-part) :realized))

 

I don't know if you included the "(kind :contents)" exactly like that or not. The way the syntax is described for this command appears to be different than how it is written for other commands; the "()" and the work "kind" should not be included.

View solution in original post

3 REPLIES 3
PeterKehoe
5-Regular Member
(To:ThomasKirkman)

This is what I typed in on my command line which worked:

 

(display (oli:sd-inq-part-density (oli:sd-inq-curr-part) :realized))

 

I don't know if you included the "(kind :contents)" exactly like that or not. The way the syntax is described for this command appears to be different than how it is written for other commands; the "()" and the work "kind" should not be included.

(sd-inq-part-density part &optional (kind :realized))

is the correct LISP syntax description of this function

 

the &optional means that the second argument can be omitted - and in that case the default value is taken for

the second argument. This is standard LISP convention. In fact, if you are writing your own function, that is exaclty the way to define it in LISP:

 

(defun my-own-part-densitity part &optional (kind :realized)

      (when (eq kind :realized)

           ,,,,,,

     )

)

 

The way Pete used (called) this function is correct.
The syntax as described in the manual is also correct.

I found the issue, it actually had nothing to do with this command, but the way I  was formatting the result.  I was looking for a number, and if the results were nil I would get an error.  I had some instance density set to None.

Creo Element\Direct Modeling 20.6.0.0.0
Top Tags