sinnerboy Posted April 12, 2012 Share Posted April 12, 2012 Is there a lisp out there that when you click on a block that you then get a text paste stating the block name ? Quote Link to comment Share on other sites More sharing options...
stevesfr Posted April 12, 2012 Share Posted April 12, 2012 Is there a lisp out there that when you click on a block that you then get a text paste stating the block name ? Here ya go. HTH, Steve blockname.lsp Quote Link to comment Share on other sites More sharing options...
sinnerboy Posted April 12, 2012 Author Share Posted April 12, 2012 :D:D Many thanks Quote Link to comment Share on other sites More sharing options...
stevesfr Posted April 14, 2012 Share Posted April 14, 2012 You're welcome ! Have fun ! Quote Link to comment Share on other sites More sharing options...
Dadgad Posted April 14, 2012 Share Posted April 14, 2012 (edited) You're welcome ! Have fun ! That is a very helpful little tool, thanks steve! Does anybody know how this would need to be altered to add the text in paperspace, instead of modelspace? Edited April 14, 2012 by Dadgad Quote Link to comment Share on other sites More sharing options...
pBe Posted April 14, 2012 Share Posted April 14, 2012 That is a very helpful little tool, thanks steve! Does anybody know how this would need to be altered to add the text in paperspace, instead of modelspace? Not sure what you mean that Dadgad Anonymous Name Friendly (defun c:BlockName (/ #Ent #Point) [color=blue](vl-load-com) [/color] (and [color=blue](setq #Ent (ssget "_:S:E" '((0 . "INSERT")))) [/color] (setq #Point (getpoint "\nSpecify placement point for MText: ")) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 7 (getvar "textstyle")) (cons 10 (trans #Point 1 0)) (cons 1 [color=blue](vla-get-EffectiveName (vlax-ename->vla-object (ssname #Ent 0)))[/color]) ) ;_ list ) ;_ entmake ) ;_ and (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 14, 2012 Share Posted April 14, 2012 Here's another version, tweaked to work with Dynamic Blocks and for all UCS / Views: (defun c:bn ( / e p ) (vl-load-com) (if (and (setq e (ssget "_+.:E:S" '((0 . "INSERT")))) (setq e (vlax-ename->vla-object (ssname e 0))) (setq p (getpoint "\nSpecify Point for MText: ")) ) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 7 (getvar 'TEXTSTYLE)) (cons 10 (trans p 1 0)) (cons 11 (getvar 'UCSXDIR)) (cons 210 (trans '(0.0 0.0 1.0) 1 0 t)) (cons 1 (vlax-get-property e (if (vlax-property-available-p e 'effectivename) 'effectivename 'name ) ) ) ) ) ) (princ) ) EDIT: Oops! pBe beat me to it Quote Link to comment Share on other sites More sharing options...
pBe Posted April 14, 2012 Share Posted April 14, 2012 (cons 11 (getvar 'UCSXDIR)) (cons 210 (trans '(0.0 0.0 1.0) 1 0 t)) Nice addition EDIT: Oops! pBe beat me to it Doesn't happen very often though Cheers Lee Quote Link to comment Share on other sites More sharing options...
Dadgad Posted April 14, 2012 Share Posted April 14, 2012 Nice addition Thanks to both of you, and I agree that the UCS function is a really nice added touch, as I want to use this from various perspectives, including isometrics. No problem, just set the UCS to VIEW and good to go from any perspective. After my last post as I was walking out the door to eat I realized I should have mentioned that too. My previous question still stands however. My blocks are in modelspace, but I am annotating in paperspace. Sure I could do them all and then filter select them and do a CHANGESPACE on the whole lot. After the point is selected in modelspace, could it be translated to paperspace, and the MTEXT inserted there? Very frustrating to be so illisperate. The only computer class I ever took was at Berkeley in 1969, things have changed a bit since then. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 14, 2012 Share Posted April 14, 2012 Try this (for use through a Viewport): (defun c:bn ( / e p ) (vl-load-com) (if (and (setq e (ssget "_+.:E:S" '((0 . "INSERT")))) (setq e (vlax-ename->vla-object (ssname e 0))) (setq p (getpoint "\nSpecify Point for MText: ")) ) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 7 (getvar 'TEXTSTYLE)) (cons 10 (trans (trans p 1 2) 2 3)) (cons 11 (getvar 'UCSXDIR)) (cons 50 (getvar 'VIEWTWIST)) (cons 410 (getvar 'CTAB)) (cons 210 (trans '(0.0 0.0 1.0) 1 0 t)) (cons 1 (vlax-get-property e (if (vlax-property-available-p e 'effectivename) 'effectivename 'name ) ) ) ) ) ) (princ) ) EDIT: Updated to account for ViewTwist Quote Link to comment Share on other sites More sharing options...
pBe Posted April 14, 2012 Share Posted April 14, 2012 for use through a Viewport Now I see, thats what he meant by PAPERSPACE. Quote Link to comment Share on other sites More sharing options...
Dadgad Posted April 14, 2012 Share Posted April 14, 2012 Lee, thank you very much, that's outstanding, don't even need to reset the UCS. My appetite has been seriously whetted by this little exercise. Keep up the great work! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 14, 2012 Share Posted April 14, 2012 Lee, thank you very much, that's outstanding, don't even need to reset the UCS. My appetite has been seriously whetted by this little exercise. Keep up the great work! Thanks Dadgad, you're very welcome Quote Link to comment Share on other sites More sharing options...
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.