Hi all,
How can i update by a lisp program different values in a block ?
I have got a Lisp program that insert value from MASSPROP in a block but all value are in mm / mm ² / mm3 / mm4 But I want that all this value are in cm / cm² / cm3 / cm4.
Thank you for your help,
Hi Gregory,
Sorry about the long delay.
Do you still have this issue ?
Will a manual conversion of the values to cm, cm2, cm3, cm4 from mm, mm2, mm3, mm4 not work ?
For example,
;convert length units from mm to cm
(setq len (/ len 10.0))
;convert area from mm2 to cm2
(setq area (/ area 100.0))
; convert volume from mm3 to cm3
(setq vol (/ vol 1000.0))
; convert area moment of inertia from mm4 to cm4
(set ixx (/ ixx 10000.0))
Regards,
Balaji
Hi,
Thank you for your reply,
In my complete lisp file, I introduce for example (setq CXX (/ CXX 10)) but I have got en error !
Error: bad argument type: numberp: "10.695"
in my case CXX is 10.695
how can manage this ?
I join my lisp file.
thank you for your help,
Hi,
Since you have already converted cxx to string using rtos, the division fails.
converting it back to float using atof should help.
(setq cxx (/ (atof cxx) 10))
Regards,
Balaji
Thank you very much, for your reply.
I found the solution.
(setq CXXmm (atof CXX))
(setq CXX (cvunit cxxmm "mm" "cm"))
But I need to reconvert cxx in string in order to be use in a list.
Do you have any idea ?
Sorry, I may be missing something here.
will "rtos" and "atof" not help in doing these conversions to and from string ?
Regards,
Balaji
Well, this command line (setq cxx (/ (atof cxx) 10)) help a lot !
after this cxx is a real value but in my lisp file after i need to insert in a attribut block but does not work.
i join my latest lisp file in pdf, please convert it from pdf to lsp.
thank you
Hi,
The link to the PDF does not work ok. Can you please email me the lisp, drawing file and the provide the steps to reproduce the problem ?
You can email me using balaji dot ramamoorthy at autodesk dot com
As I mentioned earlier, will "rtos" and "atof" not help in doing these conversions to and from string ?
Also, you can simply not replace cxx by using another variable if that will help.
(setq cxx1 (/ (atof cxx) 10))
; Use cxx for the attributes...
Regards,
Balaji
Hello,
Thank you for your help, i foud a solution.
I learn Lisp program and I arrive to solve my issue.
The file in PDF need to be convert in .lsp to be use in AutoCAD.
Thanks again,