mkp6486 Posted May 25, 2012 Share Posted May 25, 2012 Hello everyone, I am new here and was hoping I could find some help. I am using Spaces within AutoCAD MEP and I would like to have the ability to rename my spaces easily by selecting the space, then selecting the roomname/number text provided by the architect. This would save tremendous amounts of time, as the spaces must be renamed by typing in a name and number for hundreds of rooms. I have attached an image for clarity. This would allow me to export my gbXML space/zone data clearly labeled for cooling/heating load analysis. If no such lisp routine exists, can anyone point me in the right direction for a lisp that inserts selected text into a property? Thank you very much for any help! Quote Link to comment Share on other sites More sharing options...
MSasu Posted May 25, 2012 Share Posted May 25, 2012 Looks like you are willing to modify by AutoLISP a custom entity of MEP – I’m not aware that SPACE entity is available in Vanilla AutoCAD. For this reason will be easy to get support from someone using MEP too. Just to see that the associated list of this entity can be accessed and modified, please paste the code below to your command line, select a SPACE item and post here the result. Thank you. (entget (car (entsel))) Quote Link to comment Share on other sites More sharing options...
mkp6486 Posted May 25, 2012 Author Share Posted May 25, 2012 Thank you for the reply. Here are the results of the command: Command: (entget (car (entsel))) Select object: ((-1 . <Entity name: 7ffff265c00>) (0 . "AEC_SPACE") (5 . "5BD0") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 7ffff265c10>) (102 . "}") (330 . <Entity name: 7ffff2459f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "G-Spce")) Quote Link to comment Share on other sites More sharing options...
MSasu Posted May 25, 2012 Share Posted May 25, 2012 Unfortunately looks that the features of that entity aren’t exposed directly, so, without access to MEP, it will be very taught to debug a code to modify it. Quote Link to comment Share on other sites More sharing options...
mkp6486 Posted May 25, 2012 Author Share Posted May 25, 2012 Ok, understood. Thank you for your time anyway. Maybe someone else with MEP could offer some insight. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 25, 2012 Share Posted May 25, 2012 Welcome to CADTutor! Provided that the text entity does not have any wonky formatting, this should work: (defun c:RS () (c:RenameMepSpace)) (defun c:RenameMepSpace (/ *error* _Nomutt) (princ "\rRENAMEMEPSPACE ") (vl-load-com) (defun *error* (msg) (and oldNomutt (setvar 'nomutt oldNomutt)) (if acDoc (vla-endundomark acDoc)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it (princ)) (defun _Nomutt (on /) (if on (setvar 'nomutt 0) (setvar 'nomutt 1))) ((lambda (acDoc oldNomutt / ssSpace ssText name) (if (and (_Nomutt T) (princ "\nSelect space object to name: ") (_Nomutt nil) (setq ssSpace (ssget ":S:E:L" '((0 . "AEC_SPACE")))) (_Nomutt T) (princ "\nSelect text to name space object: ") (_Nomutt nil) (setq ssText (ssget ":S:E:L" '((0 . "MTEXT,TEXT"))))) (progn (vla-startundomark acDoc) (setq name (vla-get-textstring (vlax-ename->vla-object (ssname ssText 0)))) (while (vl-string-search "\\P" name) (setq name (vl-string-subst " " "\\P" name))) (vla-put-name (vlax-ename->vla-object (ssname ssSpace 0)) name) (_Nomutt T) (prompt (strcat "\n\nMEP Space renamed >> " name)) (*error* nil)) (cond (ssText (*error* "No space selected")) ((*error* nil))))) (vla-get-activedocument (vlax-get-acad-object)) (getvar 'nomutt))) ** Tested using AutoCAD MEP 2012 Quote Link to comment Share on other sites More sharing options...
mkp6486 Posted May 25, 2012 Author Share Posted May 25, 2012 Wow, that was fast! Thank you so much! Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 25, 2012 Share Posted May 25, 2012 Wow, that was fast! Thank you so much! Happy to help. 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.