PDA

View Full Version : saving points


tflaherty
2005-05-27, 10:19 PM
Here's a sample of my code that draws the overhang (sofit, fascia, etc) for a user supplied pitch. There are certain points along the line that is drawn I need to save (assign to a variable) so that I can come back later and draw another line, on a different layer, that goes in another direction but starts at that point.

(setvar "clayer" "brick")
(command "line"
HIP_IP
(strcat "@" FASCIA_LNG "<180")
(strcat "@" FASCIA_HGT "<90") NEED TO SAVE THIS POINT
(strcat "@" DRIP1 "<180")
(strcat "@" DRIP2 "<90")
(strcat "@" DRIP3 "<0") "") NEED TO SAVE THIS POINT
(setvar "clayer" "roof")
(command "line" "" (strcat "@24<" SLOPE "") ""
) ;_ end of command

madcadder
2005-05-27, 11:42 PM
Here's a sample of my code that draws the overhang (sofit, fascia, etc) for a user supplied pitch. There are certain points along the line that is drawn I need to save (assign to a variable) so that I can come back later and draw another line, on a different layer, that goes in another direction but starts at that point.

(setvar "clayer" "brick")
(command "line"
HIP_IP
(strcat "@" FASCIA_LNG "<180")
(strcat "@" FASCIA_HGT "<90") NEED TO SAVE THIS POINT
(strcat "@" DRIP1 "<180")
(strcat "@" DRIP2 "<90")
(strcat "@" DRIP3 "<0") "") NEED TO SAVE THIS POINT
(setvar "clayer" "roof")
(command "line" "" (strcat "@24<" SLOPE "") ""
) ;_ end of command
I have a long way of doing it. Instead of starting the line command using all the "@" signs you would use POLAR and define all the points (ie: pt1, pt2, pt1a, pt1b, pt1a1, etc) and then draw your lines from point to point as needed.
this is a portion of old code from when i worked for another company. Notice all the points and then at the end it starts the line commands.

(command "pline" ; outside
(setq |shp| (polar |shplacement| (|shdtr| 90) |shwh|)) ; up
(setq |shp1| (polar |shp| (|shdtr| 0) |shww|)) ; right
(setq |shp2| (polar |shp1| (|shdtr| 270) |shwh|)) ; down
(setq |shp3| (polar |shp2| (|shdtr| 180) |shww|)) ; left
"close"
)
(setq |shx| (car |shplacement|))
(setq |shy| (cadr |shplacement|))
(setq |shz| (caddr |shplacement|))
(setq |shx1| (+ |shx| 0.6875))
(setq |shy1| (+ |shy| 0.5625))
(setq |shplacement2| (list |shx1| |shy1| |shz|))
(command "pline" ; inside1
(setq |shpa| (polar |shplacement2| (|shdtr| 90) (- |shwh| 1.5))) ; up
(setq |shpa1| (polar |shpa| (|shdtr| 0) (- |shww| 1.375))) ; right
(setq |shpa2| (polar |shpa1| (|shdtr| 270) (- |shwh| 1.5))) ; down
(setq |shpa3| (polar |shpa2| (|shdtr| 180) (- |shww| 1.375))) ; left
"close"
)
(setq |shbx| (car |shplacement2|))
(setq |shby| (cadr |shplacement2|))
(setq |shbz| (caddr |shplacement2|))
(setq |shcx| (car |shpa|))
(setq |shcy| (cadr |shpa|))
(setq |shcz| (caddr |shpa|))
(setq |shbx1| (+ |shbx| 1.096))
(setq |shcx1| (+ |shcx| 1.096))
(setq |shbx16| (list |shbx1| |shby| |shbz|))
(setq |shbx2| (list |shcx1| |shcy| |shcz|))
(setq |shbx3| (+ |shbx| 1.783))
(setq |shcx3| (+ |shcx| 1.783))
(setq |shbx15| (list |shbx3| |shby| |shbz|))
(setq |shbx4| (list |shcx3| |shcy| |shcz|))
(setq |shbx5| (car |shpa1|))
(setq |shby5| (cadr |shpa1|))
(setq |shbz5| (caddr |shpa1|))
(setq |shbx6| (car |shpa2|))
(setq |shby6| (cadr |shpa2|))
(setq |shbz6| (caddr |shpa2|))
(setq |shcx5| (- |shbx5| 1.096))
(setq |shcx6| (- |shbx6| 1.096))
(setq |shbx7| (list |shcx5| |shby5| |shbz5|))
(setq |shbx8| (list |shcx6| |shby6| |shbz6|))
(setq |shcx7| (- |shbx5| 1.783))
(setq |shcx7a| (- |shbx5| 1.096))
(setq |shcx8| (- |shbx6| 1.783))
(setq |shbx9| (list |shcx7| |shby5| |shbz5|))
(setq |shbx10| (list |shcx8| |shby6| |shbz6|))
(setq |shbx11| (- |shcy| 0.8125))
(setq |shbx13| (list |shbx3| |shbx11| |shbz|))
(setq |shbx14| (list |shcx7| |shbx11| |shbz|))
(setq |shbx17| (+ (/ (+ |shby5| |shby6|) 2) 2))
(setq |shbx18| (list |shbx3| |shbx17| |shbz|))
(setq |shbx19| (list |shcx7| |shbx17| |shbz|))
(setq |shbx20| (- (/ (+ |shby5| |shby6|) 2) 0.59375))
(setq |shbx21| (list |shbx3| |shbx20| |shbz|))
(setq |shbx22| (list |shcx7| |shbx20| |shbz|))
(setq |shbx23| (+ (/ (+ |shby5| |shby6|) 2) 1.325))
(setq |shbx24| (list |shbx3| |shbx23| |shbz|))
(setq |shbx25| (list |shcx7| |shbx23| |shbz|))
(setq |shbx26| (+ (/ (+ |shby5| |shby6|) 2) 0.125))
(setq |shbx27| (list |shbx3| |shbx26| |shbz|))
(setq |shbx28| (list |shcx7| |shbx26| |shbz|))
(setq |shbx28a| (list |shcx7a| |shbx26| |shbz|))
(setq |shbx29| (+ |shy| 2.625))
(setq |shbx30| (list |shbx3| |shbx29| |shbz|))
(setq |shbx31| (list |shcx7| |shbx29| |shbz|))
(setq |shbx32| (+ |shy| 1.732))
(setq |shbx33| (list |shbx3| |shbx32| |shbz|))
(setq |shbx34| (list |shcx7| |shbx32| |shbz|))
(command "break" "last" |shbx4| |shbx9|)
(command "line" |shbx16| |shbx2| "") ; left side row 3
(command "line" |shbx15| |shbx4| "") ; left side row 4
(command "line" |shbx7| |shbx8| "") ; right side row 3
(command "line" |shbx9| |shbx10| "") ; right side row 4
(command "line" |shbx13| |shbx14| "") ; top most horizontal
(command "line" |shbx18| |shbx19| "") ; upper most meeting rail
(command "line" |shbx21| |shbx22| "") ; lower most meeting rail
(command "line" |shbx24| |shbx25| "") ; upper mid meeting rail
(command "line" |shbx27| |shbx28| "") ; lower mid meeting rail
(command "line" |shbx30| |shbx31| "") ; upper bottom sash
(command "line" |shbx33| |shbx34| "") ; mid bottom sash
(setq |shsc1| (polar |shbx16| (|shdtr| 0) 12))
(setq |shsc2| (polar |shbx16| (|shdtr| 90) 12))
(command "pline" |shbx16| |shsc1| |shsc2| "close")

kennet.sjoberg
2005-05-27, 11:53 PM
Here's a sample of my code. . .

(setvar "clayer" "brick")
(command "line"
HIP_IP
(strcat "@" FASCIA_LNG "<180")
(strcat "@" FASCIA_HGT "<90") ;;NEED TO SAVE THIS POINT
(setq Pkt1 (getvar "LASTPOINT" ) ) ;; well, just do it
(strcat "@" DRIP1 "<180")
(strcat "@" DRIP2 "<90")
(strcat "@" DRIP3 "<0") ;; NEED TO SAVE THIS POINT
(setq Pkt2 (getvar "LASTPOINT" ) ) ;; well, just do it
""
)
(setvar "clayer" "roof")
(command "line" "" (strcat "@24<" SLOPE "") "" )


: ) Happy Computing !

kennet

tflaherty
2005-05-28, 12:18 AM
***!!!LASTPOINT!!!***


DUH!!!!

I wast just trying to use last and, OF COURSE, it wasn't working.


Thank You God, for the wisdom of other men and their willingness to share it!!!

kennet.sjoberg
2005-05-28, 01:42 AM
Sorry, the solution is not good, it create zero length lines by lastpoint. :sad:

: ) Happy Computing !

kennet

tflaherty
2005-05-28, 02:29 AM
Not if I turn the osnaps off.

kennet.sjoberg
2005-05-28, 11:28 PM
Not if I turn the osnaps off.
No, that is not true. The zero length line is created anyway.
But You can use this code instead that save all points
(command "line"
HIP_IP
(setq pkt1 (polar HIP_IP pi (atof FASCIA_LNG )))
(setq pkt2 (polar pkt1 (/ pi 2 ) (atof FASCIA_HGT ))) ;;NEED TO SAVE THIS POINT
(setq pkt3 (polar pkt2 pi (atof DRIP1 )))
(setq pkt4 (polar pkt3 (/ pi 2 ) (atof DRIP2 )))
(setq pkt5 (polar pkt4 0 (atof DRIP3 ))) ;; NEED TO SAVE THIS POINT
""
)
: ) Happy Computing !

kennet