All Activity
- Past hour
-
A Need for Info on Getting Started: Plotting in Batch from the Model Tab
Steven P replied to Clint's topic in AutoLISP, Visual LISP & DCL
Thanks, I've updated the code above - Today
-
@BIGAL Thanks a lot! It works great! Before running the command, you need to set the color of the BILAYER, otherwise, all lines of the same color are obtained. I am adding this line to the code (setvar "cecolor" "bylayer") Then the lines are always created correctly...
-
Join endpoints of multiple polylines to common point
DAVID_OJEDA replied to Jozef13's topic in AutoLISP, Visual LISP & DCL
thank you, it works wonderfully. It helps me a lot. -
marko_ribar started following Join endpoints of multiple polylines to common point
-
Join endpoints of multiple polylines to common point
marko_ribar replied to Jozef13's topic in AutoLISP, Visual LISP & DCL
@DAVID_OJEDA Here is Lee Mac's code without BBC tags... You should get no errors... (defun c:cpt ( / a b e i p q s x ) (if (and (setq s (ssget "_:L" '( (-04 . "<OR") (000 . "LINE") (-04 . "<AND") (000 . "*POLYLINE") (-04 . "<NOT") (-04 . "&=") (070 . 1) (-04 . "NOT>") (-04 . "AND>") (-04 . "OR>") ) ) ) (setq p (getpoint "\nSpecify common point: ")) (setq p (trans p 1 0)) ) (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) x (entget e) ) (if (= "POLYLINE" (cdr (assoc 0 x))) (progn (setq e (entnext e) x (entget e) a x ) (while (= "VERTEX" (cdr (assoc 0 x))) (setq b x e (entnext e) x (entget e) ) ) (setq q (if (< (distance p (cdr (assoc 10 a))) (distance p (cdr (assoc 10 b)))) a b)) (if (entmod (subst (cons 10 p) (assoc 10 q) q)) (entupd (cdr (assoc 330 q))) ) ) (apply '(lambda ( a b / q ) (setq q (if (< (distance p (cdr a)) (distance p (cdr b))) a b)) (if (entmod (subst (cons (car q) p) q x)) (entupd e) ) ) (if (= "LINE" (cdr (assoc 0 x))) (list (assoc 10 x) (assoc 11 x)) (list (assoc 10 x) (assoc 10 (reverse x))) ) ) ) ) ) (princ) ) HTH. M.R. -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
this is exactly what I need. Thank you very much to all of you guys I hope I can be an expert in making autolisp like all of you -
Can anyone help me? get the attribute value based on the block name
marko_ribar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
Here, try this mhupp's mod... ;;----------------------------------------------------------------------------;; ;; PULL BLOCKS NAME TO UPDATE ATTRIBUTE (defun C:ATTBLKNAME () (C:ABN)) (defun C:ABN ( / effectivename ent Name Att ) (defun effectivename ( ent / blk rep ) (if (wcmatch (setq blk (cdr (assoc 2 (entget ent)))) "`**") (if (and (setq rep (cdadr (assoc -3 (entget (cdr (assoc 330 (entget (tblobjname "block" blk) ) ) ) '("AcDbBlockRepBTag") ) ) ) ) (setq rep (handent (cdr (assoc 1005 rep)))) ) (setq blk (cdr (assoc 2 (entget rep)))) ) ) blk ) (while (setq ent (car (entsel "\nSelect Block"))) ;gets an entity name using while will keep repeating if you keep selecting an entity (if (= (cdr (assoc 0 (entget ent))) "INSERT") ;test if its a block (progn (setq Name (effectivename ent)) ; pulls the name (setq Att (vlax-ename->vla-object (car (nentsel "Select Attribute Text to update")))) ; nentsel can get entity names inisde blocks (vla-put-textstring Att Name) ;update entity with name ) (progn ;if entity isn't a block will prompt user (prompt "\nNot a Block Pick again") (c:ABN) ;and start the comman over again. ) ) ) (princ) ) -
Join endpoints of multiple polylines to common point
DAVID_OJEDA replied to Jozef13's topic in AutoLISP, Visual LISP & DCL
Greetings dear CAD gurus. I have a problem similar to the one our friend Josef13 presents. Which consists of joining multiple end points of multiple polylines to a common point. I downloaded the routines they published to solve my problem, but they don't work for me, they give me the following errors. Routine. ;; RJP » 2018-08-15 ;; Puts plines and lines closest vertex to a common picked point. throws the following error =Command: ; error: malformed list on input. The second routine published by master Lee Mac throws the following error. Command: ; error: extra cdrs in dotted pair on input. Can you help me by explaining to me what I did wrong when executing the command? I really appreciate the help you can give me. EXAMPLE.dwg -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
I tried testing the code, but the block name I got was random like *U414 or *U180 . Not the original block name. Correct me if I'm wrong -
Can anyone help me? get the attribute value based on the block name
mhupp replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
No just me coding in notepad and not testing the code. needed to converted the nentsel to vla-object updated the code. - Yesterday
-
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
i get an error like this: error: bad argument type: VLA-OBJECT <Entity name: 181bbe5aaf0> Is there anything I did wrong? But, thank you for helping me -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
I don't know what's wrong, but I get an error like this: error: bad argument type: VLA-OBJECT <Entity name: 181bbe5aaf0> But, thank you for helping me -
Can't copy/output results from a FIND list
BIGAL replied to mjf1999's topic in AutoCAD 2D Drafting, Object Properties & Interface
Do you want 1 string search to excel or is it do repeated searches. Please confirm. -
Can anyone help me? get the attribute value based on the block name
BIGAL replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
"Sorry got caught up in something. select the block then select the attribute "text" you want to update." Just select attribute ! As mentioned using nentsel this can return the tag name, then use (ssget pt) where pt is the (cadr (nentsel)) then (ssname ss 0) (setq ent (nentsel "\nPick an attribute ")) (setq pt (cadr ent)) (setq tagname (cdr (assoc 2 (entget (car ent))))) (setq ss (ssget pt)) (setq blk (ssname ss 0)) (setq blkname (cdr (assoc 2 (entget blk)))) ; dont really need this for the task -
You can be lucky owe me a cup of coffee. ; Oct 2022 ; By AlanH makes a legend of used layers and blocks. (defun RemoveDupes (InLst / OutLst CarElm) (while InLst (setq InLst (vl-remove (setq CarElm (car InLst)) (cdr InLst)) OutLst (cons CarElm OutLst) ) ) ) (defun makelegend ( / ss lst lstrem obj pt pt2 ltname x val bname) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setvar 'textstyle "Standard") (setq oldlay (getvar 'clayer)) (setvar 'clayer "0") (setvar 'ctab "Model") (setq ss (ssget "X" (list (cons 410 "Model")))) (setq lst '()) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq lst (cons (list (vla-get-layer obj) (vlax-get obj 'Linetype)) lst)) ) (setq lst (RemoveDupes lst)) (setq lst (vl-sort lst '(lambda (x y) (< (car x) (car y))))) (setq pt (getpoint "\nPick point for line legend ")) (setq pt2 (mapcar '+ pt (list 125.0 0.0 0.0))) (foreach ltname lst (command "line" pt (mapcar '+ pt (list 20.0 0.0 0.0)) "") (command "chprop" (entlast) "" "LA" (car ltname) "LT" (cadr ltname) "S" 0.25 "") (command "text" (mapcar '+ pt (list 25.0 0.0 0.0)) 2.5 0.0 (car ltname)) (setq pt (mapcar '+ pt (list 0.0 10.0 0.0))) ) (setq lst '()) (setq attreq 0) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (if (= (vla-get-objectname obj) "AcDbBlockReference") (setq lst (cons (vla-get-name obj) lst)) ) ) (setq lst (RemoveDupes lst)) (setq lst (vl-sort lst '(lambda (x y) (< x y)))) (foreach val lst (if (wcmatch val "*U#*" ) (setq lst (vl-remove val lst)) ) ) (foreach bname lst (progn (command "text" (mapcar '+ pt2 (list 25.0 0.0 0.0)) 2.5 0.0 bname) (command "-insert" bname pt2 1 1 0) (setq pt2 (mapcar '+ pt2 (list 0.0 10.0 0.0))) (setq obj (vlax-ename->vla-object (entlast))) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (setq ht (- (cadr pointmax)(cadr pointmin))) (setq xscale (/ 5.0 ht)) (vla-put-xscalefactor obj xscale) (vla-put-yScaleFactor obj xscale) ) ) (setvar 'osmode oldsnap) (setvar 'clayer oldlay) (princ) ) (makelegend)
-
mikehsr joined the community
-
Can anyone help me? get the attribute value based on the block name
mhupp replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
Sorry got caught up in something. select the block then select the attribute "text" you want to update. ;;----------------------------------------------------------------------------;; ;; PULL BLOCKS NAME TO UPDATE ATTRIBUTE (defun C:ATTBLKNAME () (C:ABN)) (defun C:ABN (/ SS lst Name Att) (while (setq ent (car (entsel "\nSelect Block"))) ;gets an entity name using while will keep repeating if you keep selecting an entity (progn (if (= (cdr (assoc 0 (setq lst (entget ent)))) "INSERT") ;test if its a block (progn (setq Name (cdr (assoc 2 lst))) ; pulls the name (setq Att (vlax-ename->vla-object (car (nentsel "Select Attribute Text to update")))) ; nentsel can get entity names inisde blocks (vla-put-textstring Att Name) ;update entity with name ) (progn ;if entity isn't a block will prompt user (prompt "\nNot a Block Pick again") (c:ABN) ;and start the comman over again. ) ) ) ) (princ) ) --edit updated code -
Biokpo joined the community
-
Is it possible to get lines with all layer properties using lisp, and next to each line, specify the name of the layer. Maybe there is already such a lisp?
-
REBAR QUANTITIES AND LENGTH CALCULATIONS WITH TABLE TO EXCEL
achila replied to achila's topic in AutoLISP, Visual LISP & DCL
This is the format of a drawing I was trying to use the lisp for in the similar way on the attached video clip. qstoolblock.dwg -
Lisp for plates weight calculator.
SANDIP PAITAL replied to eyal's topic in AutoLISP, Visual LISP & DCL
Dear Sir, Please share latest updated Lisp for plates weight calculator. -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
I apologize in advance, I don't understand the syntax. I'm still a beginner at this. What I want to get after selecting the attribute is that the attribute value will contain the name of the object block that I previously selected. -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
I got this error: error: ADS request error do you know what happened? -
lrm started following How to close weld gap in AutoCad 3D
-
How to close weld gap in AutoCad 3D
lrm replied to Emboss 2014's topic in AutoCAD 3D Modelling & Rendering
Assuming that you have geometry like this: and you want to fill in the corner like this: Define a UCS for each of the end planes of the welds and create closed polylines (red and green below) on each plane. Use loft to create the solid between them. -
Can anyone help me? get the attribute value based on the block name
mhupp replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
Chage "ATT ID" to what ever the tag is if you wanted to update the Date text (setpropertyvalue (ssname att 0) "DATE" "Today") -
Can anyone help me? get the attribute value based on the block name
marko_ribar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
You didn't answered to question : What do you get when you pick an attribute with this syntax : (cdr (assoc 2 (entget (car (nentsel))))) Then you should nest ATTRIB entity to desired block with this firstly posted code in this post : https://www.theswamp.org/index.php?topic=55172.msg594767#msg594767 After you nest ATTDEF, change line 8 in my posted code with correct TAGNAME you pulled from written syntax : (cdr (assoc 2 (entget (car (nentsel)))))... Here is the code where you should alter line 8 : (defun c:blknames2attvalues ( / s i e n x ) (prompt "\nSelect blocks to fill their attributes with their block names...") (if (setq s (ssget "_:L" (list (cons 0 "INSERT") (cons 66 1)))) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i)))) (setq n (cdr (assoc 2 (entget e)))) (while (= (cdr (assoc 0 (setq x (entget (setq e (entnext e)))))) "ATTRIB") (if (= (strcase (cdr (assoc 2 x))) (strcase TAGNAME)) (entupd (cdr (assoc -1 (entmod (subst (cons 1 n) (assoc 1 x) x))))) ) ) ) ) (princ) ) HTH. M.R. -
Can anyone help me? get the attribute value based on the block name
Kvlar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
I got this error: error: ADS request error do you know what happened? -
Can anyone help me? get the attribute value based on the block name
marko_ribar replied to Kvlar's topic in AutoLISP, Visual LISP & DCL
Change this line in qouted code : (setpropertyvalue (ssname att 0) "ATT_ID" n) To this line : (setpropertyvalue (ssname att 0) "TextString" n)