hkamal Posted August 25, 2021 Posted August 25, 2021 (defun c:mnum () (setvar "osmode" 0) (setq i (getint "\n Value to start with ---->") name (getstring "\n Sewer Name ----->") p 0 a 0 poi '() poi1 '() pn '() ) (while (= a 0) (setq poi (cdr (assoc 10 (entget (car (entsel)))))) (if (> p 0) (progn (IF (and (>= (ANGLE POI POI1) (/ 11 7)) (<= (ANGLE POI POI1) (/ 33 7)) ) (SETQ MH "MH") (SETQ MH "MH") ) (IF (and (>= (ANGLE POI POI1) (/ 11 7)) (<= (ANGLE POI POI1) (/ 33 7)) ) (SETQ pn poi) (SETQ pn poi1) ) (IF (and (>= (ANGLE POI POI1) (/ 22 7)) (<= (ANGLE POI POI1) (/ 33 7)) ) (SETQ PN POI) ) (command "-layer" "s" "sewer_manh" "") (command "-insert" MH poi "" "" POI1 (strcat "MH" (rtos (+ i p) 2 0)) ) (command "-layer" "s" "sewer" "") (command "line" poi poi1 "") (command "-layer" "s" "SEWER NAME" "") (command "-insert" "sewer name" (list (/ (+ (car poi) (car poi1)) 2) (/ (+ (cadr poi) (cadr poi1)) 2) ) "" "" pn name ) ) ) (setq poi1 poi) (setq p (+ p 1)) ) ) Hello I want to create a labeling lisp based on this code, this code was constructed in 2003 and it doesn't work on AutoCAD 2020 Steps that lisp will do 1- Asking for starting number for MNH 2- Asking for the name of the pipe Line name (examples: K , K-1 , K-1-22) 3- Clicking on the line so the lisp will draw a block with MNH-# and MNH-#+1 at the ends of the line and putting the Line name in the middle After that just clicking on the lines and the sequence will repeat Note : Common issue I think duplicating the MNH blocks and naming numbers at the connection ends when clicking on the next line Quote
tombu Posted August 25, 2021 Posted August 25, 2021 As the lisp doesn't create or import the blocks it inserts I'm assuming they're already in the drawing by way of a default template drawing. It would need to be attached before we could attempt to debug the lisp. (IF (and (>= (ANGLE POI POI1) (/ 11 7)) (<= (ANGLE POI POI1) (/ 33 7)) ) (SETQ MH "MH") (SETQ MH "MH") ) sets global variable MH to the string "MH" whether the if statement is True or not then (command "-insert" MH attempts to insert a block MH which is actually defined as a string. I find it hard to believe this code ever worked. Lisp hasn't changed that much. 1 1 Quote
BIGAL Posted August 26, 2021 Posted August 26, 2021 Have you looked at sewer / drainage design software add ons ? Will do auto what you want and way much more. Quote
hkamal Posted August 26, 2021 Author Posted August 26, 2021 Can you tell me the best sewer / drainage design software add ons yo use? Quote
Steven P Posted August 26, 2021 Posted August 26, 2021 I haven't looked at your code, but where and how doesn't it work? Does it get to a point and stop with or without an error, does it run all the way through and do nothing? Quote
BIGAL Posted August 27, 2021 Posted August 27, 2021 I use Civil Site Design, https://civilsitedesign.com I will see if can find a youtube showing sewer design. Quote
Recommended Posts
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.