Over 1.096.000 registered users (EN+CZ).
AutoCAD tips, Inventor tips, Revit tips.
Try the new precise Engineering calculator and the updated Barcode generator.
New AutoCAD 2026 commands and variables.
Discussion forum
?CAD discussions, advices, exchange of experience

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
|
Post Reply ![]() |
Author | ||
mfkozlow ![]() Groupie ![]() Joined: 14.Jul.2014 Location: United States Using: AutoCAD Electrical 2014 Status: Offline Points: 25 |
![]() Posted: 13.Aug.2014 at 20:23 |
|
Hello everyone!
I found some code (lisp) that will return a variable with the attribute value of a block. Everything works great, the block only has one attribute so it does not cause complications in this rather simple code. My problem is with the user input portion. After the code lisp is initiated, AutoCAD asks me to select the block I wish to extract the attribute value form. Ideally I would like this to happen automatically. I want the lisp to always check the same exact block that will be located in the same exact spot. If anyone knows a way please let me know! I have been working on this for way too long. Here is the lisp: (defun C:get_att_now () (if (setq ent(entsel "\n Select a Block: ")) (progn (setq en(car ent)) (setq enlist(entget en)) (setq blkType(cdr(assoc 0 enlist))) (if (= blkType "INSERT") (progn (if(= (cdr(assoc 66 enlist)) 1) (progn (setq en2(entnext en)) (setq enlist2(entget en2)) (setq enlist3(cdr(assoc 1 enlist2))) (while (/= (cdr(assoc 0 enlist2)) "SEQEND") (princ "\n ") (princ enlist2) (setq en2(entnext en2)) (setq enlist2(entget en2)) ) ) ) ) ) ) ) ) Note: This is the code that causes user input... (if (setq ent(entsel "\n Select a Block: ")) I have tried the "ssget" function, but haven't had any luck. Please help! |
||
![]() |
||
Vladimir Michl ![]() Moderator Group ![]() Arkance Systems CZ Joined: 26.Jul.2007 Location: Czech Republic Using: Autodesk software Status: Offline Points: 2120 |
![]() |
|
Try to replace the lines:
with:
|
||
Vladimir Michl (moderator)
ARKANCE - https://arkance.world - Autodesk Platinum Partner |
||
![]() |
||
mfkozlow ![]() Groupie ![]() Joined: 14.Jul.2014 Location: United States Using: AutoCAD Electrical 2014 Status: Offline Points: 25 |
![]() |
|
Thank you for the quick reply!
![]() Unfortunately this did not seem to work. When I run the command it returns "nil". If you need any other information let me know. Also, how did you get the dotted lines for the code...just for future reference. I know this is a dumb question, but I'm new to forums. Thanks. |
||
![]() |
||
mfkozlow ![]() Groupie ![]() Joined: 14.Jul.2014 Location: United States Using: AutoCAD Electrical 2014 Status: Offline Points: 25 |
![]() |
|
I solved this with help from Vladimir. Instead of using:
(2 . "MYBLOCKNAME")I used this: (8 . "LAYERNAME")I simply put the block that I was extracting the attribute from on its own layer called "QSP". Thank you again, you pointed me in the right direction! ![]() |
||
![]() |
||
Vladimir Michl ![]() Moderator Group ![]() Arkance Systems CZ Joined: 26.Jul.2007 Location: Czech Republic Using: Autodesk software Status: Offline Points: 2120 |
![]() |
|
Great! I am glad it works for you.
The {CODE} section is inserted using BBcodes - see the help link here under the Message posting editor.
|
||
Vladimir Michl (moderator)
ARKANCE - https://arkance.world - Autodesk Platinum Partner |
||
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0,070 seconds.