• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Active Member
    Posts: 7
    Registered: ‎02-16-2010

    Diesel expression help (area)

    343 Views, 13 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
    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,167
    Registered: ‎09-13-2004

    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
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎02-16-2010

    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?
    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,167
    Registered: ‎09-13-2004

    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
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎02-16-2010

    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)
    Please use plain text.
    Distinguished Contributor
    Posts: 460
    Registered: ‎12-15-2003

    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}
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎02-16-2010

    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...
    Please use plain text.
    Distinguished Contributor
    Posts: 460
    Registered: ‎12-15-2003

    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}
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎02-16-2010

    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.
    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,167
    Registered: ‎09-13-2004

    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
    Please use plain text.