Author Topic: Layer Names After Xref Bind  (Read 5498 times)

0 Members and 1 Guest are viewing this topic.

dfarris75

  • Guest
Layer Names After Xref Bind
« on: September 16, 2009, 04:00:41 PM »
Is there a setting that controls what the layer output is when you bind an xref? When you bind one you get those extra characters in there and I'd sorely like to replace the gobbly gook with a simple dash so the layer names just assume the dwg name as a prefix.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #1 on: September 16, 2009, 04:49:10 PM »
Is there a setting that controls what the layer output is when you bind an xref? When you bind one you get those extra characters in there and I'd sorely like to replace the gobbly gook with a simple dash so the layer names just assume the dwg name as a prefix.
as you have MAP and could query all this data together; why bother with Xref-binding at all?

you may need some snippet of LISP....or you could configure the cad manager tools to swap out the bad names for the desired ones...
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #2 on: September 16, 2009, 04:50:13 PM »
moderator, could we move this to a general cad question discussion group?

this isn't Land or C3d specific...
Be your Best


Michael Farrell
http://primeservicesglobal.com/

dfarris75

  • Guest
Re: Layer Names After Xref Bind
« Reply #3 on: September 16, 2009, 05:13:21 PM »
For one (1) the various surveyors we receive surveys from all use their own layering schemes. It would require setting up many different queries or layer translation files. Heck, some of the surveyors even use different layering schemes within their own house.

And two (2), I find that an xref bind is quick and simple.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Layer Names After Xref Bind
« Reply #4 on: September 16, 2009, 05:35:19 PM »
You can use the rename command, but you have to use the dialog box, as the command line version won't allow you to use the ' * ' in the layer name.  Just enter the prefix with the asterisk, and then in the new name section, put the new prefix with another asterisk after.  Tested in '06.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Layer Names After Xref Bind
« Reply #5 on: September 16, 2009, 05:46:42 PM »
Something like this could do it.
Code: [Select]
(defun XrefNameFix (#Replace)
  (and
    (snvalid #Replace)
    (vlax-for x (vla-get-layers
                  (vla-get-activedocument
                    (vlax-get-acad-object)
                  ) ;_ vla-get-activedocument
                ) ;_ vla-get-layers
      (and (vl-string-search "$0$" (vla-get-name x))
           (vl-catch-all-apply
             'vla-put-name
             (list x (vl-string-subst #Replace "$0$" (vla-get-name x)))
           ) ;_ vl-catch-all-apply
      ) ;_ and
    ) ;_ vlax-for
  ) ;_ and
) ;_ defun
Call it like:
Code: [Select]
(XrefNameFix "_")
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #6 on: September 16, 2009, 06:05:18 PM »
or use INSERT instead of bind...unless you are attempting to preserve the XREF file name in the layer...

The Query>>ALL process would have no bearing on their layer names, or lack of following their own layer naming convention.
I use the MAP>>Query process most of the time to handle data from other sources such as you are dealing with.
Then during the import process, once can use an Alter Properties statement, and a Range Table to MAP their layer names to the desired layer names.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Layer Names After Xref Bind
« Reply #7 on: September 16, 2009, 06:32:24 PM »
or use INSERT instead of bind...unless you are attempting to preserve the XREF file name in the layer...

The Query>>ALL process would have no bearing on their layer names, or lack of following their own layer naming convention.
I use the MAP>>Query process most of the time to handle data from other sources such as you are dealing with.
Then during the import process, once can use an Alter Properties statement, and a Range Table to MAP their layer names to the desired layer names.
I didn't know you could do that in Map, pretty sweet. Going to have a look in the morning.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #8 on: September 16, 2009, 06:44:49 PM »
or use INSERT instead of bind...unless you are attempting to preserve the XREF file name in the layer...

The Query>>ALL process would have no bearing on their layer names, or lack of following their own layer naming convention.
I use the MAP>>Query process most of the time to handle data from other sources such as you are dealing with.
Then during the import process, one can use an Alter Properties statement, and a Range Table to MAP their layer names to the desired layer names.
I didn't know you could do that in Map, pretty sweet. Going to have a look in the morning.

Your work order is as follows
open empty drawing in MAP
Attach a source file
Use the Location button on the Query Composer to select ALL, or the desired boundary for advanced users.
Then use the DATA button, and Select Layers, this will give you the list of Existing layers in the source file
Click Alter Propertiesm, Look for Ranges... in the lower right hand quadrant.
Then create the alter properties of Layers Range Table where One Layer in the Source is mapped to the correct layer in the destination file. Once you have all layers in the source related to layers in the destination, then alther the layer properties using the range table you just made.
Execute the query, and now all items on the BAD layer named layers, are all now on the desired layers in the destination file.

I await A) your triumphant exultation of success, B) your next question.

This is why I always try to include at lease three(3) MAP examples in all of my Civil3D classes....as long as MAP is there we might as well leverage some of it's power.
« Last Edit: September 16, 2009, 07:14:46 PM by mjfarrell »
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Layer Names After Xref Bind
« Reply #9 on: September 17, 2009, 08:40:53 AM »
I dont have Map and Michaels solution sounds very good, but I have found laytrans to be very effective. Say you have 3 main clients that you always have to change their layernames and there is some kind of consistency, (although you have said there isn't) you can translate a dwg from each client, using new layer to create the correct name (this will take a while) for each layer then when you translate the dwg save the translation (it can be saved as a dwg or a .dws file.) . Next time you get a dwg from the same client import the saved translation and most of the work will be done. Translate any new layers then save over the .dws file, so it will get bigger and more useful over time. So you could have 3 files that do 95% of the work in seconds.

dfarris75

  • Guest
Re: Layer Names After Xref Bind
« Reply #10 on: September 17, 2009, 08:42:29 AM »
It would take a while to come up with a range table to cover all layers from all surveyors. I guess it could be periodically built upon though...

I was using xref bind to add the prefix to the layers to 1. make it easier to distinguish between survey layers and our layers. And 2. to group said layers together for easier sorting/navigation in the layer manager.

Perhaps I will go with the query/range table option and begin building it when I run out of work again. I could take an assortment of surveys that we have received from the various surveyors and insert them all into one dwg for a comprehensive layer list which I could then build the range table from.

Thanks again Mike. You're my hero.

dfarris75

  • Guest
Re: Layer Names After Xref Bind
« Reply #11 on: September 17, 2009, 08:48:05 AM »
Bryco, that would work too. The advantage to using Map query over the layer translator is that you can open your template dwg that is preloaded with all your goodies and query in the survey (or whatever file you're after) data all at once while performing the layer translation via the range table at the same time so you reduce both your work and your effort.

This would be the better option especially if you use a product such as Civil 3d that is style based.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #12 on: September 17, 2009, 10:10:19 AM »
.

This would be the better option especially if you use a product such as Civil 3d that is style based.

UH, you are forgetting something terribly important here:


MAP will NOT query ANY CIVIL3D OBJECTS!  I've been howling mad about this for over 6 years people!
When are you going to beat up your autocad vendor and help me help you to get MAP to work with C3D objects?  We need this functionality returned to us NOW!
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Layer Names After Xref Bind
« Reply #13 on: September 17, 2009, 10:13:15 AM »
Rusty, you do not or should not attempt to create a single Range Table that will handle all survey files from all sources.
You even state the reason for this; THEY do not always follow their own layer standards!  So just do this as needed, and or create a saved query after the fact, for EACH of the different sources of these files.  You'll get it done faster, and you wont go insane attempting to relate 1000's of layers for others into your layer schema.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

dfarris75

  • Guest
Re: Layer Names After Xref Bind
« Reply #14 on: September 17, 2009, 05:14:35 PM »
UH, you are forgetting something terribly important here:


MAP will NOT query ANY CIVIL3D OBJECTS!  I've been howling mad about this for over 6 years people!
When are you going to beat up your autocad vendor and help me help you to get MAP to work with C3D objects?  We need this functionality returned to us NOW!

It doesn't matter cuz I don't believe any of our surveyors are using Civil 3d.