Jump to content

Lisp to add prefix to Layer State layers


thefootyguru

Recommended Posts

Hi all

 

I need a lisp that adds a prefix to all layer state layers.

 

So here is my situation, I work at a civil engineering consultancy who design mostly residential subdivisions. We have standard layers set up to keep everything consistent ie 'd driveway' or 'd back of kerb' ect and I have created a series of layer states for a range of of our standard drawings, ie 'set out plan' or 'detail plan'.

 

My problem is these layer states will not work because when the drawing is xref'd in the layers now carry the prefix of the drawing name ie 'monbulk design xref/ d back of kerb'.

 

As these layers are standard for every job we do I need a lisp that will either allow the layer state to ignore the drawing name prefix or will add the drawing name prefix to the layer state layer names.

 

Thank you to everyone who stops by and reads this post.

Any help will be very much appreciated.

Link to comment
Share on other sites

You need to look at which drawings is going to be the master, we had some drawings supplied to us like this where the design was xrefed in to the production drawing it was a pain to keep opening the xref to make a simple little change, we ended up BINDING the design to get around the problem, so my suggestion is make your Design the master this is the drawing you will do the most work in.

Link to comment
Share on other sites

When a drawing is XREF'd, it's layerstates come with it. They control the XREFd layers. Is that what you are looking for?

Link to comment
Share on other sites

Try this program to rename all layer names with a prefix specified by the user .

 

(defun c:addPrefixtoLayerNames  (/ fx ly ln nm en)
 ;; Tharwat 16.06.2015	;;
 (cond
   ((= "" (setq fx (getstring t "\nSpecify the Prefix string to add to layers :")))
    (princ "\nExit with not action !"))
   ((not (snvalid fx)) (princ "\nInvalid Prefix string !"))
   (t
    (while (setq ly (tblnext "LAYER" (not ly)))
      (if (and (not (wcmatch (setq ln (cdr (assoc 2 ly)))
                             "*|*,0,Defpoints"))
               (not (tblsearch "LAYER" (setq nm (strcat fx ln))))
               )
        (entupd
          (cdr
            (assoc
              -1
              (entmod
                (subst
                  (cons 2 nm)
                  (assoc
                    2
                    (setq en (entget (tblobjname "LAYER" ln))))
                  en)))))
        )
      )
    )
   )
 (princ)
 )

Link to comment
Share on other sites

Robdraw he doesn't want this

 

... but it sounds like he does.

 

I need a lisp that will either allow the layer state to ignore the drawing name prefix or will add the drawing name prefix to the layer state layer names.

 

If the layer state is in the XREFd drawing, it comes in with the reference and does exactly what he asked, sans LISP, unless I am reading it wrong.

Link to comment
Share on other sites

The world may never know as it was his first post. We know a lot of first time posters don't come back to follow up their questions.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...