Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Member
10 Posts
0 Kudos
Registered: ‎02-16-2010
Post 1 of 15

Diesel expression help (area)

444 Views, 14 Replies
02-16-2010 12:03 PM
Can someone explain how I can update my diesel expression to display the area in square feet not square inches. See expression below. Thanks

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;$M=$(getvar,AREA);attdia;1
*Expert Elite*
5,990 Posts
663 Kudos
Registered: ‎09-13-2004
Post 2 of 15

Re: Diesel expression help (area)

02-16-2010 01:04 PM in reply to: wilco4
I'm not fluent enough in Diesel, but Lisp should work in a macro like that, too, something like this:

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;(/ (getvar 'area) 144);attdia;1

or if it needs to be a text string:

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;(rtos (/ (getvar 'area) 144) 2 2);attdia;1

Change that last 2 if you want more [or fewer] decimal places.

--
Kent Cooper


wilco4 wrote...
Can someone explain how I can update my diesel expression to display the area in square feet not square inches. ....

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;$M=$(getvar,AREA);attdia;1
Kent Cooper
Active Member
10 Posts
0 Kudos
Registered: ‎02-16-2010
Post 3 of 15

Re: Diesel expression help (area)

02-16-2010 01:15 PM in reply to: wilco4
Thanks for the help but it's still not working right. Below are the results I get:

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;(/ (getvar 'area) 144);attdia;1 gives me the follwoing: (/ (getvar 'area) 144)

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;(rtos (/ (getvar 'area) 144) 2 2);attdia;1 gives me the follwoing: (rtos (/ (getvar 'area) 144) 2 2)


Here's what I get using my current expression on the same room:

^C^Cattdia;0;_-insert;AREABLK;\1;1;0;$M=$(getvar,AREA);attdia;1 gives me 57600


Any thoughts?
*Expert Elite*
5,990 Posts
663 Kudos
Registered: ‎09-13-2004
Post 4 of 15

Re: Diesel expression help (area)

02-16-2010 01:37 PM in reply to: wilco4
Oops -- it's taking input for an Attribute value literally, rather than evaluating the Lisp expression. Try starting with this:

^C^Cattdia;0;texteval;1;_-insert....

and then end with

....attdia;1;texteval;0

I'm not sure why it should take a Lisp expression literally but not a Diesel expression, when TEXTEVAL is 0, but as I said, I'm not very experienced with Diesel. However, if the above doesn't work, someone who is more familiar with it should be able to do the same calculation [dividing your original expression by 144] in Diesel language.

--
Kent Cooper
Kent Cooper
Active Member
10 Posts
0 Kudos
Registered: ‎02-16-2010
Post 5 of 15

Re: Diesel expression help (area)

02-16-2010 01:50 PM in reply to: wilco4
Thanks again for trying but it's still not working. Below is my result using the latest expression:

(/ (getvar 'area) 144)
Distinguished Contributor
463 Posts
2 Kudos
Registered: ‎12-15-2003
Post 6 of 15

Re: Diesel expression help (area)

02-16-2010 03:21 PM in reply to: wilco4
{code}^C^Cattdia;0;_-insert;AREABLK;\1;1;0;$M=$(rtos,$(getvar,AREA),4,3);attdia;1{code}
Active Member
10 Posts
0 Kudos
Registered: ‎02-16-2010
Post 7 of 15

Re: Diesel expression help (area)

02-16-2010 05:05 PM in reply to: wilco4
Getting closer. That expression divides the square inches by 12 and it actually needs to be divided by 144. Thanks...
Distinguished Contributor
463 Posts
2 Kudos
Registered: ‎12-15-2003
Post 8 of 15

Re: Diesel expression help (area)

02-16-2010 06:20 PM in reply to: wilco4
Maybe this?
{code}^C^Cattdia;0;_-insert;AREABLK;\1;1;0;$M=$(rtos,$(/,$(getvar,AREA),144),2,3);attdia;1{code}
Active Member
10 Posts
0 Kudos
Registered: ‎02-16-2010
Post 9 of 15

Re: Diesel expression help (area)

02-16-2010 07:24 PM in reply to: wilco4
That worked. Thanks for the help. One last question. Is there a way to remove the decimal point and/or zeros. It shows up as 400.000 if not no big deal.
*Expert Elite*
5,990 Posts
663 Kudos
Registered: ‎09-13-2004
Post 10 of 15

Re: Diesel expression help (area)

02-16-2010 07:42 PM in reply to: wilco4
Changing that 3 to a 0 [the precision argument in (rtos)] should do it.

--
Kent Cooper


wilco4 wrote...
.... Is there a way to remove the decimal point and/or zeros. ....
Kent Cooper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post