• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

new functions

  • Thread starter Thread starter micgiul
  • Start date Start date

micgiul

Guest
Hello everyone!

I've been playing with the lisp for a few days.

I found a macro, exporting the structure tree to excel.
I also made some variation and hoc understood enough how it works.

Now I also wanted to add a field with weight.
I searched for the sd-type function in the inintegration kit, one that would return my weight, but I found only the one that returns the density sd-inq-part-density.

Then I thought that if I found one returning the volume, it was enough to multiply. . .

I couldn't findrl, then I found a macro lisp that returns the density and mass of a group.

to find density use the above function, to find weight instead use:
(sd-call-cmds(get_vol_prop :for_part :part obj :tol :percent_tol 10 :mass))

My question is:
where it jumped furoi function get_vol_prop?

I attach the macro to completeness.

Thank you.
Michael
 

Attachments

in moedling in the calculation menu part you find the volume as well as the mass density baricentro and ltro...
 
graize as always for the answer.

I know that there is the calculation function of the modeling part, but if I want to recall these functions in lisp, where I find, the description of the various commands.

because I would like to complete a macro that I am doing that besides the distinct draws me out also its weights.

Hello and thank you
Michael
 
(in-package :prova)
(use-package :oli)

(sd-defdialog 'list_density

:dialog-title "lista di massa e densita"

:variables
'(
(assy :value-type :assembly :modifies :nil :initial-value (sd-pathname-to-obj "/") :title "gruppo")
(count_csn :initial-value nil :multiple-items t)
(tot :initial-value nil :multiple-items t)
(p-count :initial-value nil :multiple-items t)
(a-count :initial-value nil :multiple-items t)
(obj :modifies :nil)
)

:local-functions
'(
(doit ()
(display " massa : densita : nome parte ")
(display "====== ======= ===========")
(setf tot (jb-inq-obj-tree-list assy))
(dolist (obj tot "done")
(setf vlag 0)
(setf partje (equal (sel_item-type obj) *sd-part-seltype*))
(setf sampje (equal (sel_item-type obj) *sd-assembly-seltype*))
(if (equal partje t) (setf vlag 1)())
(if (equal sampje t) (setf vlag 0)())
(if (equal vlag 1)
(progn
(setf dens (sd-sys-to-user-units :density (sd-inq-part-density obj)))
(setf mas (sd-sys-to-user-units :mass (sd-call-cmds(get_vol_prop :for_part obj :tol :percent_tol 10 :mass))))
(display (format nil "~6,6f : ~6,6f : ~a" mas dens (sd-inq-obj-basename obj)))
(display " ")
)())
)
;(fit_vp "vport1")
(update_screen)
)
)

;:mutual-exclusion
;'(assy)

:ok-action
'(doit)
)

(defun jb-inq-obj-tree-list (obj)
(cons obj
(apply #'nconc
(mapcar #'jb-inq-obj-tree-list
(sd-inq-obj-children obj)
)
)
)
)
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top