Search the Community
Showing results for tags 'lisp edit'.
-
Dears, May anyone help me in modifying the lisp attached... the lisp attached deduce the invert level based on 01- Pipe Start Elevation 02- Pipe Slope 03- Flow direction and the final result is as shown on the image shown below What I need is to put the absolute elevation on the form "IL.0.0000MM" & add another two text captions the relative elevation"IL.-0.0000FFL" & Pipe type and size"(WP/SP/RWP0000MM" the inputs are 1- FFl Reference Level where "IL.-0.0000FFL" will be a result of [ absolute level - relative level ] 2- Pipe type is SP or WP or RWP & 50/75/110/160/ or 200 MM The result I need as an example is in the below shot: Please help me. thanks in advance SD.LSP
-
Bearing and Dimension lisp routine questions
drafting1768 posted a topic in AutoLISP, Visual LISP & DCL
Hi. I have a lisp routine that I use all the time but I'm wondering if someone could please tell me how the routine sets the following variables: 1. The number of decimal places (precision) that the distance displays at. It currently displays it to 2 decimal places, I'd like to have 3 eg. 0.000 2. The text offset distance from the line. Thank you all in advance! (defun get_endpts (/ a b) (COMMAND "OSNAP" "ENDP") (setq a (getpoint "\nEnter first point: ")) (setq b (getpoint "\nEnter second point: ")) (COMMAND "OSNAP" "NONE") (list a b) ) (defun c:setdim () ;(initget (+ 1 2 4)) ;(setq scalefactor (getreal "\nEnter scale factor: ")) (if (not setmap) (load "setmap") ) (setmap) (setq scalefactor #mapsc) ;(initget 1 "Y y N n") ;(setq angflg (question "Do you want azimuths printed?")) (setq angflg "Y" angmessage "WILL") ;(cond (angflg ; (if (not (setq dimrotation (getangle "\nEnter angular rotation: "))) ; ;(setq dimrotation #mapang ) ; (setq DIMROTATION 0) ; ) ; (initget 1 "1 5") ; (setq secprec (atoi (getkword "\nRound off seconds to nearest <1 or 5> "))) ; ) ;) (setq dimrotation 0 secprec 5 secsmessage "5") (alert (strcat "DIMLINE SETTINGS: \n\nScale Factor set to: " (rtos scalefactor 2 6) "\nAzimuths " angmessage " print." "\nSeconds rounded off to " secsmessage "\"" "\n\n\nTo change the Scale Factor use MAP SETTINGS CSF \+ ROTATION \non the LISP pulldown.\n\nTo change other settings type SETDIM2.")) (setq dimset T) (princ) ;(chgsize (* (/ scalex 1000) 1.95)) );defun setdim (defun c:setdim2 () (initget (+ 1 2 4)) ;(setq scalefactor (getreal "\nEnter scale factor: ")) (if (not setmap) (load "setmap") ) (setq scalefactor #mapsc) (initget 1 "Y y N n") (setq angflg (question "Do you want azimuths printed?")) (if angflg (progn (setq DIMROTATION 0 angMessage "WILL") (initget 1 "1 5") (setq secsMessage (getkword "\nRound off seconds to nearest <1 or 5> ")) (setq secprec (atoi secsmessage)) ) (setq angMessage "WON'T" ) ) (alert (strcat "DIMLINE SETTINGS: \n\nScale Factor set to: " (rtos scalefactor 2 6) "\nAzimuths " angmessage " print." "\nSeconds rounded off to " secsmessage "\"" "\n\n\nTo change the Scale Factor use MAP SETTINGS CSF \+ ROTATION \non the LISP pulldown.")) (setq dimset T) ;(chgsize (* (/ scalex 1000) 1.95)) ) (defun c:dimline (/ L A B ucsflg) (load "F1") (cond ((not dimset) (c:setdim))) (if (/=(getvar "WORLDUCS") 1) (progn (command "UCS" "W") (setq UCSflg T) );progn );if (setq L (getline)) (dimfunc (getassoc 10 L) (getassoc 11 L) (placetxt (getassoc 10 L) (getassoc 11 L)) ) (if UCSflg (COMMAND "UCS" "P") ) ) (defun c:dimpts (/ ENDPTS ucsflg) (load "F1") (cond ((not dimset) (c:setdim))) (if (/=(getvar "WORLDUCS") 1) (progn (command "UCS" "W") (setq UCSflg T) );progn );if (dimfunc (car(setq ENDPTS(get_endpts))) (cadr ENDPTS) (placetxt (car ENDPTS)(cadr ENDPTS)) ) (if UCSflg (COMMAND "UCS" "P") ) ) (defun dimfunc (a b below / angab distab ctrpt d) (setq angab (angle a b)) (setq distab (distance a b)) (setq ctrpt (polar a angab (/ distab 2))) (setq d (/ distab scalefactor)) (cond (below (cond ((and (> angab (+ NORTH 0.1744)) (<= angab (+ SOUTH 0.1744))) (writedim d angab ctrpt (+ angab A90) (- angab PI) 1.20 2.85) ) (T (writedim d angab ctrpt (+ angab A270) angab 1.20 2.85)) ) ) (T (cond ((and (> angab (+ NORTH 0.1744)) (<= angab (+ SOUTH 0.1744))) (writedim d angab ctrpt (+ angab A270) (- angab PI) 1.20 2.85) ) (T (writedim d angab ctrpt (+ angab A90) angab 1.20 2.85)) ) ) ) ) (defun writedim (d azimuth ctrpt perpang orientation sp1 sp2 / textpt scalept) ;(switchl "DIMENSION") (setq textpt (polar ctrpt perpang (* (getxtht) sp1))) (setq scalePt ctrpt) (COMMAND "TEXT" "M" textpt (angtos orientation) (rtos d 2 2)) (cond (angflg (setq textpt (polar ctrpt perpang (* (getxtht) sp2))) (COMMAND "TEXT" "M" textpt (angtos orientation) (writeang (+ angab (dtr dimrotation))) ) )) (if (= (substr (getvar "CLAYER") 1 2) "34") (progn (findDetailScale) (if (and (/= nil detTxtScl)(/= 0.0 detTxtScl)) (command "SCALE" (lastn 2) "" scalept detTxtscl) (command "SCALE" (lastn 2) "" scalept theRatio) ) ) ) ; (switchl nil) ) (defun findDetailScale ( / detLayer detLen det7thLast undScr) (if (not c:lastn) (load "LASTN") ) (if (null theRatio) (progn (load "labelling") (c:detail) ) ) (setq detLayer (getvar "CLAYER")) (setq detlen (strlen detLayer)) (setq det7thLast (substr detLayer (- detLen 6))) (setq undScr (st_scan "_" det7thlast)) (setq detTxtScl (/ (* 0.001 (atoi (substr det7thLast (+ 1 undScr)))) plscale)) ) (defun writeang (azimuth) (setq azimuth (angtos azimuth 1 4)) (if (= "d" (substr azimuth 3 1)) (strcat (deg_format azimuth 3)) (if (= "d" (substr azimuth 4 1)) (strcat (deg_format azimuth 4)) (strcat (deg_format azimuth 2)) ) ) (cond ((= 5 secprec) (cond ((< 7 (last_digit seconds)) (setq seconds (additostr seconds (- 10 (last_digit seconds)))) ) ((< 2 (last_digit seconds)) (setq seconds (additostr seconds (- 5 (last_digit seconds)))) ) (T (setq seconds (additostr seconds (- 0 (last_digit seconds))))) ) (if (= (strlen seconds) 1) (setq seconds (strcat "0" seconds))) (if (= "60" seconds) (progn (setq seconds "00") (setq minutes (additostr minutes 1)) (if (= (strlen minutes) 1) (setq minutes (strcat "0" minutes))) (if (= "60" minutes) (progn (setq minutes "00") (setq degrees (additostr degrees 1)) )) )) )) (if (/= (strcase (getvar "LOGINNAME")) "Pam.hvizdos") (strcat degrees "%%d" minutes "'" seconds "\"") (strcat degrees "%%d" minutes "'" seconds "\"") ) ) (defun deg_format ( str pos) (setq degrees (substr str 1 (- pos 1))) (min_format (substr str (+ pos 1))) ) (defun min_format (str) (setq minutes (cond ((= "'" (substr str 2 1)) (sec_format (substr str 3)) (strcat"0" (substr str 1 1)) ) (T (sec_format (substr str 4)) (substr str 1 2) ) ) ) ) (defun sec_format (str) (setq seconds (substr (if ( = 2 (strlen str)) (strcat "0" str) str ) 1 2 )) ) (defun last_digit(str) (atoi (substr str (strlen str))) ) (defun additostr(str no) (itoa (+ (atoi str) no)) ) -
I was asked to help figure out why a certain lisp routine which worked with Autocad 2014 doesn't work with AutoCAD MEP 2015. Although I don't know much about Autolisp, I thought I'd give it a try, but I've gotten to a stopping point and cannot get past it. I am posting the lisp routine along with some associated dwgs and a screen capture of what it's supposed to look like when it does work in hopes that someone can assist with this. Your help is greatly appreciated. dflex.lsp FlexDuct.dwg FlexDrop.dwg
-
Hi All, I'm hoping to get some help in editing a LISP routine please. I have a LISP created by Charles Darling http://www.gilesdarling.me.uk/lisproutines.shtml which i'm hoping to get some assistance editing slightly to suit my needs better. I have a cable route which I am trying to create KP (Kilometer Post) flags along. the chainage lisp allows me to do this, but is limited to a point. The current lisp creates markers at a user specified distance, but only plots the units as meters 700.000. Ideally i'd like to turn the markers into kilometers i.e. 4.5etc. please see attached image for example of desired outcome. Hope this makes sense and someone is able to help here. Thanks. chainage.lsp
- 3 replies
-
- kp flag
- autocad 2014
-
(and 1 more)
Tagged with: