• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Active Member
    Posts: 7
    Registered: ‎10-03-2012

    Re: naming a single layout tab to match the file name

    10-11-2012 07:06 AM in reply to: pbejse

    I am unable to get it to work, probably because im pretty new to Autolisp. Can i get more direction?

    Thanks

    Please use plain text.
    *Expert Elite*
    Posts: 2,129
    Registered: ‎11-24-2009

    Re: naming a single layout tab to match the file name

    10-11-2012 06:19 PM in reply to: bdcurry

    bdcurry wrote:

    I am unable to get it to work, probably because im pretty new to Autolisp. Can i get more direction?

    Thanks


    If you can tell us whats happening when you say unable to get it work. and it wouldnt work for text/mtext.

    whats the error message if any?

     


    As i explained from the previous post, there are strings that are considered invalid characters  "<>/\":;?*|,=`" for layout name

     

    Mtext usually have the "\\P" , code for new line. you probably didnt notice the error message after you click on a text/mtext with invalid characters. it would say at the command prompt 

     

    The following characters are not valid in layout names:  <>/\":;?*|,=`

     

    Is that whats happening on your case? If not the, post a sample drawing and we'll figure out together

     

    Help us help you......

     

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,129
    Registered: ‎11-24-2009

    Re: naming a single layout tab to match the file name

    10-11-2012 08:20 PM in reply to: pbejse

    A quick mod [not tested]

     

    (defun C:RTT (/ str)				; = Rename Tab to match Text
      (if (and  (/= (getvar 'ctab) "Model")
               (setq str (cdr (assoc 1 (reverse
    	    (entget (car (nentsel
    		  "\nSelect Text/Mtext/Attribute to change Layout Tab name to its content: "
    		))))))))
    	   (progn
    	     (foreach kk '("\\P" "<" ">" "/" "\\" ":" ";" "?" "`*" "|" "," "=" "``")
                   (while (vl-string-search kk str)
    		(setq str (vl-string-subst (if (eq kk "\\P") " " "") kk str))
    		))   
        		(command "_.layout" "_rename" (getvar 'ctab) str)		
        		)
        (prompt "\nCannot rename Model space tab.") 
      )
      (princ)
    )

     

    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎10-03-2012

    Re: naming a single layout tab to match the file name

    10-12-2012 07:41 AM in reply to: pbejse

    Ok the problem is that my Attributed block has multiple lines and it only renames the layout with one line..

    Example..."Chilled Beam Cooling Water Diagram" is the full title

    Each part of the title is didvided like this in the block...

    Sheet title 1 = Chilled Beam

    Sheet title 2  = Cooling Water

    Sheet Tile 3 = Diagram

    When i select the block it only renames the layout with "Chilled Beam"

    or if i click "Cooling Water" it will rename the layout "Cooling Water" and so on...it will only read one line of the block.

    I need it to read all three lines of the block and rename accordingly. Is there a way to have it rename it by the Tag or Prompt within the block? (fyi most on my blocks will have 5-7 lines of info)

     

    i just tested the text/mtext title and it is working with the new lisp you sent above. Thanks!

     

    I have atttached an example for the block.

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,129
    Registered: ‎11-24-2009

    Re: naming a single layout tab to match the file name

    10-12-2012 08:14 AM in reply to: bdcurry

    bdcurry wrote:

    Ok the problem is that my Attributed block has multiple lines and it only renames the layout with one line..

    Example..."Chilled Beam Cooling Water Diagram" is the full title

    Each part of the title is didvided like this in the block...

    Sheet title 1 = Chilled Beam

    Sheet title 2  = Cooling Water

    Sheet Tile 3 = Diagram

    When i select the block it only renames the layout with "Chilled Beam"

    or if i click "Cooling Water" it will rename the layout "Cooling Water" and so on...it will only read one line of the block.

    I need it to read all three lines of the block and rename accordingly. Is there a way to have it rename it by the Tag or Prompt within the block? (fyi most on my blocks will have 5-7 lines of info)

     

    i just tested the text/mtext title and it is working with the new lisp you sent above. Thanks!

     

     


    Kudos to Kent Cooper, It was really his idea.  :smileyhappy:

     

    As for your request, i can think of a couple ways to do that.  easiest way is to use TAG names but it would be specific to a particular block. perhaps a prompt would be better .. we'll see, but it will have to wait till tomorrow .

     

    Cheers

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,129
    Registered: ‎11-24-2009

    Re: naming a single layout tab to match the file name

    10-14-2012 12:36 AM in reply to: pbejse

    I thought about this and made some test codes. I believe the best way to deal with attributes is to use a listbox. That way you can select the strings you want to use as layout name. But only if you select an  attribute.

     

    The TAG reference is a good idea,but i would prefer to make the code generic .

     

    usage:

    command: RTT

     

    If selected entity is an attribute this will appear

     

    strings.jpg

     

     

    HTH

     

     

    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎10-03-2012

    Re: naming a single layout tab to match the file name

    10-15-2012 07:40 AM in reply to: pbejse

    Works Perfect!!!

     

    Thank you all for your work in solving this for me.

    Please use plain text.