Jump to content

MINOR edits to a lisp? please help


dnovember99

Recommended Posts

On 1/4/2018 at 6:47 PM, BIGAL said:

Just copy and paste the block only into your new dwg, dont use insert, then erase it the block definition will remain, if you paste and the block already exists if it asks redefine say yes. (roy_043)

 

The block should be in your DWT if it exists now and is visible in the dwt erase it then purge just block "pipe-calc", then copy and paste erase as I said before.

 

Glad to hear its working, I need to spend more time with feet stuff.

BIGAL! i have to say that it has been some time. 

 

i wanted to run back over this post and see how things progressed. i have been using this on a constant basis and i can thank you enough! 

 

i was trying to identify within the code the math. when you input a set of numbers, the absolute feet will show the elevation minus what was put in the starting elevation. so if it is a zero then you would end with a number in the negative. 

 

the total overall is only showing a positive number. which in turn if i was to add the minus there mentally it is only off by .01 when the math is complete. so i am trying to identify where in the code i can add or change for this to also produce a negative number? 

 

 

; simple example of filling in a block attributes with calcs
; by Alan H Dec 2017
 
(defun c:invert ( / len ans div slabd inv safety tot totslope oldatt )
 
(if (not AH:getval7) (load "getvals1-8")(princ "loaded"))
(setq oldatt (getvar 'attdia))
(setvar 'attdia 0)
(ah:getval7 "Enter desired slope 1/x 4 8 16" 5 4  "4" "Enter Finished FLR Elev. " 5 4  "100" "Enter length " 5 4 "50"  "Enter Fittings Factor  %" 5 4 "25" "Enter Starting inv " 5 4 "24" "Enter slab depth" 5 4 "4" "Enter safety " 5 4 "6" )
 
(setq div (/ (/ 1.0 (atof val1)) 12.0 ))
(setq flr (atof val2))
(setq len (atof val3))
(setq perc (/ (atof val4) 100.0))
(setq inv (/ (atof val5) 12.0))
(setq slabd (/ (atof val6) 12.0))
(setq safety (/ (atof val7) 12.0))
 
(setq totlen (+  (* len  perc) len ))
; this should return the value of total length multiplied by 25%
(setq totslope (* totlen  div) )
(setq totoall (+ (+ (+ inv slabd) safety) totslope))
(setq tot  (- flr totoall))
 
 ; this should return a value in decimal format for the finished floor elevation - total overall slope. example would be 5' 5-1/2" - 100' = 94.542
 
(command "-insert" "PIPE-CALC" (getpoint) 1 1 0   (strcat "1/" val1 "\"") val2 val3 val4 val5 val6 val7  (rtos (* totoall 12.0) 3 1)  (rtos tot  2 2))
 
(setvar 'attdia oldatt)
)
(c:pipe-calc)

i see that the math portion of this lisp is with this. 

 

(setq totlen (+  (* len  perc) len ))
; this should return the value of total length multiplied by 25%
(setq totslope (* totlen  div) )
(setq totoall (+ (+ (+ inv slabd) safety) totslope))
(setq tot  (- flr totoall))

 

 

when you have a moment to take a look at this and point me in the right direction, that would be great. 

 

Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

  • dnovember99

    30

  • BIGAL

    25

  • Roy_043

    4

  • Grrr

    2

Top Posters In This Topic

Posted Images

10 hours ago, BIGAL said:

What are the values you are using ? 

Flr=0 then tot should be negative ? 

 

 

Attached are screen shots of what is being used. for myself i see the process of this. so if you are to use a factor of 100' for your finished floor, the factors that are getting returned (in a screen shot) of 94.83 absolute feet. which one can simply look at the table and see that is 5'-2.0" below 100'. some of the advantageous snowflakes, cant see that simple math. 

 

so i thought that i would see if it would be possible to be able to do this? something that i just thought about that might also work if it is possible. what about adding to the lisp to have this return in a MText to the side the math calculation? i have been searching around trying to find something that you would be able to add this to, but i am not able to find anything. 

 

but both of these are nothing major, just more of a question.  personally this works just fine for myself. but thought that i would ask the question

pipe-calc screen shot 1.png

pipe-calc screen shot 2.png

pipe-calc screen shot 3.png

Link to comment
Share on other sites

What you can do is add to the dcl say the Total o/all and the Absolute as an answer. I have a DCL that has 3 inputs and uses combo of sliders or values entered but shows total below will have a think about it. It will mean the dcl is no longer a library function but hard coded into the code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...