Login

View Full Version : SELECTING MULTIPLE POINTS TO CREATE A MULTI LEADER TO AUGMENT AN EXISTING CUSTOM LISP



sorourke765462
2018-03-26, 09:24 PM
At present we have a number of LISP routines that I've inherited from previous CAD drafters that noone (including me) fully understands. I've managed to add/manipulate some of them, in a basic fashion, to better reflect what we need to be automated. The final hurdle to resolving most of the "We'll just manually type that stuff in" BS is way beyond my understanding.

In the attached .dwg there's a survey file of a pick-up of a stormwater drainage pit. The call-out for the 'invert' is our usual flow/size/material/depth leader, both Lisps attached.

What I need to be able to do is to expand the selection from a single point to all pipes coming in-out of the pit, the 5 magenta points in the .dwg attached represent the 5 inlet-outlets to the pit and have the attributes of :

NAME , CODE , ELEVATION , DEPTH , SIZE , MATERIAL , END , FLOW , NOTE , METHOD

Our invert callout pulls out : FLOW , SIZE (%%C) , MATERIAL , DEPTH

I'm trying to do 2 things with the information :

1: select multiple points, (replacing car with ssget?) and write them all into a mleader consecutively with the CODE at the start, which we'll nominate for the identifier number on the screen in CAD and

2: generate a fifth attribute called INVERT which would be (I assume) (setq invert (- elevation material).

so I'd get a mleader something like CODE - INLET - 125%%C - PVC
"TAPE DEPTH" - DEPTH"m"
"INVERT" - INVERT"m"
CODE - INLET - 125%%C - PVC
"TAPE DEPTH" - DEPTH"m"
"INVERT" - INVERT"m"
CODE - OUTLET - 125%%C - PVC
"TAPE DEPTH" - DEPTH"m"
"INVERT" - INVERT"m"

Any of the points (probably the first one chosen) can be the insertion points for the mleader.

Any help would be much appreciated

devitg.89838
2018-04-09, 01:05 AM
Please find and send or upload some defun , like


varopen

GA

Coordw

Varclose

it must be at the main lisp .

sorourke765462
2018-04-13, 01:11 AM
Hey dev, sorry i was away for easter.

We have a LISP in the library name "var.lsp" I'm guessing this is what you're requesting?

(defun GA (Blname / )
(setq depth () NAME () COED () ELEVATION () UTILITY () NOTE () )
(setq 1Att (entnext Blname))
(setq 1AtEnt (entget 1Att))
(while (/= (cdr (assoc 0 1AtEnt)) "SEQEND")
(progn
(setq tag (cdr (assoc 2 1AtEnt)))
(set (read tag) (cdr (assoc 1 1AtEnt)))
(setq lay (cdr (assoc 8 1AtEnt)))
(setq 1Att (entnext 1Att))
(setq 1AtEnt (entget 1Att))
)
)
)

(defun Varopen ( / )
(setq ceho (getvar "CMDECHO"))
(setq blm (getvar "blipmode"))
(setq atd (getvar "attdia"))
(setq OSM (getvar "osmode"))
(setq cl (getvar "clayer"))

(setq cs (atoi(vl-string-subst "" "1:" (getvar "cannoscale"))))

(setvar "CMDECHO" 1)
(setvar "blipmode" 0)
(setvar "attdia" 0)
(setvar "osmode" 0)
(princ)
)



(defun Varclose ( / )
(setvar "CMDECHO" ceho)
(setvar "blipmode" blm)
(setvar "attdia" atd)
(setvar "osmode" osm)
(setvar "clayer" cl)
(princ)
)

TY

BIG-AL
2018-04-17, 11:46 AM
Here is an attempt needs a bit of fine tuning but does work just not 100% to match your needs, leave to you to customise.


(defun c:labelpit ( / ss obj pt atts att )
(setq ss (ssget '((0 . "insert"))))
(repeat (setq x (sslength ss1))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(if (vlax-property-available-p obj "hasattributes")
(setq atts (vlax-invoke obj "getattributes"))
)
(setq lst2 '())
(foreach att atts
(setq lst2 (cons (vla-get-textstring att) lst2))
)

(setq pt (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'insertionpoint))))
(COMMAND "_MLEADER" pt PAUSE (strcat (nth 0 lst2) "\n" (nth 2 lst2 )))
)
)
(c:labelpit)