Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

variables in dim style

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Marlec
1036 Views, 9 Replies

variables in dim style

hi,

I'm working on an existing building, mainly its roof...i know the roof drains are all 257mm lower then the perimeter, so i want to create a time saving dim style wich would give me:

  1. the lengh of the line ( <> )
  2. a % from a fixe "Z" (formula: 257/<>*100) wich is the actual slop on the roof expressed in %
  3. and the formula <>*2% wich is the slop needed on the roof, expressed in %

I can create a dim style with 1. and 3. using alternate units... but how can i make it so it gives me 2. ?

 

I used insert field and formula in the edit of that linear dim, but it gives me the answer "#####"...

 

thanks in advance for the time you'll take to help me...

 

Martin

9 REPLIES 9
Message 2 of 10
Kent1Cooper
in reply to: Marlec


@Marlec wrote:

 

....
  1. the lengh of the line ( <> )
  2. a % from a fixe "Z" (formula: 257/<>*100) wich is the actual slop on the roof expressed in %
  3. and the formula <>*2% wich is the slop needed on the roof, expressed in %

 

....

I assume that item 3 is a minimum slope required, so what's expressed in % would always be the minimum 2%, and that what is "needed" to achieve that slope is a minimum amount of drop over the measured distance, which would be expressed in drawing units, not in %.  If that's correct, try something like this [in simplest terms, and very lightly tested] -- re-word elements, change precisions, extract what you want from it to incorporate into what you may already have.  It does it without alternate units or fields, just some calculations to incorporate into a text override on a linear Dimension.

(defun C:DD257 (); = Dimension Drain at 257-unit drop
  (command "_.dimlinear")
  (while (> (getvar 'cmdactive) 0) (command pause)); draw it
  (setq dimdata (entget (entlast)))
  (entmod
    (subst
      (cons 1
        (strcat
          "<>\\PSlope at drop of 257 = "
          (rtos (/ 25700 (cdr (assoc 42 dimdata))) 2 2); edit precision as desired
          "%\\PMin. 2% slope = drop of "
          (rtos (/ (cdr (assoc 42 dimdata)) 50) 2 2); edit precision as desired
        ); strcat
      ); cons
      (assoc 1 dimdata); text override
      dimdata
    ); subst
  ); entmod
); defun
    
Kent Cooper, AIA
Message 3 of 10
Marlec
in reply to: Kent1Cooper

I'm redrawing from old plans before going to take measures in site...

 

so 2. is from what i draw from the paper drawings... I want to spot what the slop %...

3. is what the objective but it's just a information to compare and yes i made a mistake it's in units...

 

i'm not familiar with those lines... where can i find info on how to write lines like that and the variables?

 

I'll give it a try...

Message 4 of 10
Marlec
in reply to: Marlec

it doesnt work...

 

basically, the objectif is to know ahead where i'll need to work (planification)... we're planning renovation on the existing building.

 

I just want to create a dim style that will show those info and help plan ahead the technical side,  and give me ammo for to show the boss why we need to work on a particular area... that way we can explain to our client...

 

knowing that kind of info will help plan ahead the time needed to design, coordinate with engineers, client etc

Message 5 of 10
Kent1Cooper
in reply to: Marlec


@Marlec wrote:

it doesnt work...

 

....

Not enough information....  Does it not load?  Load but doesn't recognize the command name?  Accept the command but not do anything?  Do something different from what you expect?  Etc.

 

Here's what it gives me, using a "plain" decimal-units-based Dimension Style without alternate units or anything:

 

DD257.png

Kent Cooper, AIA
Message 6 of 10
Marlec
in reply to: Kent1Cooper

the top dim is the result...

Under is what i've done with alternate units...

It helps with the designing of the curbs on the perimeter... spotting the highest "2%" and fixe the top point of the roof and design the curbs...

but i also want ammo to justify time cost on why it could take more time because of the conditions in the existing building

 

 

 

 

pentes.JPG

Message 7 of 10
Kent1Cooper
in reply to: Marlec


@Marlec wrote:

the top dim is the result... 

 


It looks like you just copied my code and pasted it all in as a text content override.  That's not the intent.  Save the code to a .lsp file, APPLOAD it, and type in DD257 as a command name to use it -- draw a Dimension from within it, and it then adds the second and third lines to the text content part.  You should get something like the image in my previous Reply.  You can replace the \\P parts with spaces or something, if you want it on one line, and change wording, and so on, as you prefer.  The resolution in your image isn't high enough for me to be able to tell what your green dimension(s) say(s), or maybe I could tailor it to be more like that.

Kent Cooper, AIA
Message 8 of 10
Marlec
in reply to: Kent1Cooper

ok...

I can create almost anything from the "customize user interface", "complicated" toolbars, menu, dynamic blocs (even if i know it can boost file size)...

but i never did .lisp ....

is there somewhere i can read more on that topic, step by step, meaning of variables etc ???

How do i make that lisp file, where do i save it how do i upload it?? i'm a noob in that field... 

 

i appreciate your help...

 

Martin

Message 9 of 10
Kent1Cooper
in reply to: Marlec


@Marlec wrote:

 

....

How do i make that lisp file, where do i save it how do i upload it?? i'm a noob in that field... 

 

....

There are lots of threads around here that talk about that, tutorials on various sites, YouTube videos, etc., but briefly:

 

Copy the code out of the code window, and Paste it into a plain-text editor such as Notepad.  Save that to a file called something meaningful, with a .lsp filetype ending, in some location you'll be able to find [preferably one that's in the Support File Search Path list in the Files tab in OPTIONS].

 

In a drawing, type APPLOAD [or just the alias AP], navigate to where you put that file, select and Load it.  Then use its command name DD257 [the part following the C: in the beginning (defun C:... line of any AutoLisp command definition].  This one starts by calling up the DIMLINEAR command for you [it's not for application to an existing Dimension, and after you've put one in, adds the other information to it.  It could be made to add that other information to existing Dimensions, if you prefer.

 

If you like it and need it a lot, there are ways such commands can be made to load automatically into every drawing you open, so you don't have to go through that Loading process yourself all the time.  Also, it could be made to take you to an appropriate Layer, and/or to set the appropriate Dimension Style, and/or control things like Object Snap modes, and various other enhancements.

Kent Cooper, AIA
Message 10 of 10
Marlec
in reply to: Kent1Cooper

Thanks a lot Kent!

 

It makes my day!

 

Martin

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost