rename xref layers

Discussion in 'AutoCAD' started by Glenn Harvey, Jul 12, 2004.

  1. Glenn Harvey

    Glenn Harvey Guest

    Is there a way to rename xref layers.

    Example

    file: road.dwg layer: highway ---> new layer: hwy

    so in any files where road.dwg is xref'ed

    layer: road|highway ---> new layer: road|hwy

    If I just rename a layer in the road.dwg then it will show up in all places
    where it is xref'ed but in some files the original layer might have had the
    properties changed or shut off in some viewports etc.

    I am a Cad manager just looking for some direction for a programmer

    Thanks for any help
     
    Glenn Harvey, Jul 12, 2004
    #1
  2. Glenn Harvey

    Mark Douglas Guest

    You can re-name a Xref from the XREF Manager. You can dbl click the name
    then type in your new name. This what you were looking for? This will allow
    you to turn layers and colors from the Xrefs.

    Mark
     
    Mark Douglas, Jul 12, 2004
    #2
  3. Glenn Harvey

    Glenn Harvey Guest

    No, I would like to rename the layer both in the original file plus any
    place it has been xref'ed
     
    Glenn Harvey, Jul 13, 2004
    #3
  4. I am not sure exactly what you want as it is early here.

    I sounds like you want to use the same road.dwg with layer: highway named
    different in different drawings as well as having different layer
    properties.

    The quick solution is to attach road.dwg and rename the xref from road to
    "new highway.dwg" . Then attach the road.dwg again and rename the xref to
    highway.dwg. It is the same xref but now you can change the same layer new
    highway|highway layer to what ever you want and also the highway|highway
    layer to something else.

    Hope this helps.

    Dave Alexander
    Keen Engineering Co. Ltd.
    www.keen.ca
     
    Dave Alexander, Jul 13, 2004
    #4
  5. Glenn Harvey

    andywatson Guest

    I think he wants a quick solution to a tedious task.
    If drawing A is referenced by umpteen drawings, and a layer within drawing A is renamed, he would like to...
    1. Find out every drawing that references drawing A
    2. Within each of those umpteen drawings, transfer the properties assigned to the old layer name to the new layer, since those properties (viewport visibility, layer color, linetype, etc) are lost after a layer is renamed.

    I don't know that there is a quick fix. It would require several steps.
    1. Before you even rename the layer, you must locate and store the path of every drawing that references drawing A.
    2. Open each drawing that references drawing A and save the properties of the layer about to be renamed in an external file that will later be used to restore those same properties to the newly renamed layer
    3. Rename the layer within drawing A (the easiest part).
    4. Open each drawing that references drawing A, apply the properties previously saved to the newly rename layer.

    Sounds like lots and lots of fun.
     
    andywatson, Jul 13, 2004
    #5
  6. Glenn Harvey

    Glenn Harvey Guest

    Yes, sorry I was not explaining my self well enough.

    What I want to know is in your step 4 instead of reassigning properties to
    the new layer is to somehow rename that xref layer.

    Thanks

    A is renamed, he would like to...
    to the old layer name to the new layer, since those properties (viewport
    visibility, layer color, linetype, etc) are lost after a layer is renamed.
    of every drawing that references drawing A.
    the layer about to be renamed in an external file that will later be used to
    restore those same properties to the newly renamed layer
    previously saved to the newly rename layer.
     
    Glenn Harvey, Jul 13, 2004
    #6
  7. Glenn Harvey

    OLD-CADaver Guest

    <<I think he wants a quick solution to a tedious task.
    If drawing A is referenced by umpteen drawings, and a layer within drawing A is renamed, he would like to... >>

    umm... then isn't the obviuous solution NOT to rename the layer in the source file???
     
    OLD-CADaver, Jul 14, 2004
    #7
  8. Glenn Harvey

    andywatson Guest

    Nope. It is not up to the drawing that xref's drawing A to decide what to name layers within drawing A.
     
    andywatson, Jul 14, 2004
    #8
  9. Glenn Harvey

    andywatson Guest

    Good Old-CADaver, you see in black and white, no grey :)
     
    andywatson, Jul 14, 2004
    #9
  10. Glenn Harvey

    Glenn Harvey Guest

    I would love to leave them the same but we are trying to move towards some
    kind of standards so we want to rename layers in a bunch of our base
    drawings but we have all of these existing drawings that have the base
    drawings as xrefs.

    For the sake of simplicity lets call the drawing "B" that drawing "A" is
    referenced into.

    Drawing "B" must save the setup/properties of its xrefs and thier layers. So
    why can't a programmer access that information and just rename that one
    layer.

    This was my vision
    1) rename layer in drawing "A"
    2) somehow open drawing "B" without loading any xrefs - rename xref layer
    using some kind of program
    3) open drawing "B" loading xref's - everything is good

    Hope this helps

    Thanks

    A is renamed, he would like to... >>
    source file???
     
    Glenn Harvey, Jul 14, 2004
    #10
  11. You have a real problem there. I would create a new Dwg A with a different
    name and with the updated layer names. Now with all new work use the new dwg
    A.When you have to reuse an existing drawing, just load it up, attach the
    new drawing A and then using the layer dialogue box and the old drawing A
    layer properties, change the new drawing A layer properties to match.
    Straight layer properties are easy, it is the vplayer properties that are
    hard as they are different for each layout viewport. I think that you have
    to simply add a message to the old drawing A giving instructions on how to
    update the dwg with the new drawing A. That way, anytime an old drawing is
    used, there is an obvious message and instruction on how to upgrade it.
    If you don't need the old dwgs, and the system of upgrading it to the new
    drawing A layer standrads is clear and pat of the old drawing A, then who
    cares.

    I think the trick is to set up a system that can be followed to upgrade the
    old drawings only as they are needed.

    Dave Alexander
    Keen Engineering Co. Ltd.
    www.keen.ca
     
    Dave Alexander, Jul 14, 2004
    #11
  12. Glenn Harvey

    Glenn Harvey Guest

    Does anyone know if it is possible to access the setup/properties of a files
    xref's from inside a program?
     
    Glenn Harvey, Jul 16, 2004
    #12
  13. Glenn Harvey

    andywatson Guest

    Glenn,
    You cannot accomplish step 2. It simply doesn't work that way. It is never an option to rename drawing A's layers from within drawing B. Additionally, if you open drawing "B" without loading any xrefs, as you suggest, drawing A's layers will not be there. Furthermore, as soon as you finish step 1, the layer will already be renamed within every drawing that references drawing A, you don't have a choice in the matter.
    Any drawing that references drawing A cannot make any changes to drawing A...it's layer names, text styles, dimension styles, etc are all read-only properties that are read in and prefixed with " Drawing A| " as the xref is loaded.

    Maybe implementing your standards "from this day forward" is a solution?
     
    andywatson, Jul 16, 2004
    #13
  14. Glenn Harvey

    Glenn Harvey Guest

    Andy thanks so much for your help, bear with my ignorance

    I understand what you are saying but inside of Drawing "B" I can change the
    lw, colour, lt, on or off in a viewport etc. of each xref layer. So drawing
    "B" must store that information. Can this infomation be accessed ?


    never an option to rename drawing A's layers from within drawing B.
    Additionally, if you open drawing "B" without loading any xrefs, as you
    suggest, drawing A's layers will not be there. Furthermore, as soon as you
    finish step 1, the layer will already be renamed within every drawing that
    references drawing A, you don't have a choice in the matter.
    A...it's layer names, text styles, dimension styles, etc are all read-only
    properties that are read in and prefixed with " Drawing A| " as the xref is
    loaded.
     
    Glenn Harvey, Jul 16, 2004
    #14
  15. Glenn Harvey

    OLD-CADaver Guest

    <<Drawing "B" must save the setup/properties of its xrefs and thier layers. So why can't a programmer access that information and just rename that one layer. >>

    You can, using refedit, unfortunately, if you have a drawing "C" that also references "A", the "visretain" layer controls are lost.

    Lesse if this makes sense, assuming visretain is on, you can control the properties of layer DWG-A|ROAD inside drawing "B". If you open DWG-A and rename that layer to PEANUT, the next time you open drawing "B" layer PEANUT will be a new layer as far as "B" is concerned, and take on the layer properties of the source file.

    It sounds like a time for exporting a layer state setting for the xref with the new layer settings.
     
    OLD-CADaver, Jul 16, 2004
    #15
  16. Glenn Harvey

    andywatson Guest

    Glenn,
    That is a good question. I know that a viewport will retain the names of layers that should be frozen within said viewport; however, the linetype and color of the layer must be stored somewhere else. And yes, they definitely are stored somewhere, hence VISRETAIN. And maybe it would also keep old layer names, like the viewport object does, until the user purges?

    Can anyone answer that question---where does a drawing store the visibility properties of an xref'd layer when VISRETAIN is turned on? And if a layer within the xref is renamed, do the instructions for the old layer remain (like they do in a paperspace viewport entity) ?
     
    andywatson, Jul 17, 2004
    #16
  17. Glenn Harvey

    andywatson Guest

    Great point...
    The layer state manager might be your answer.
     
    andywatson, Jul 17, 2004
    #17
  18. Glenn Harvey

    Art Cooney Guest

    Xref layers and their properties are always stored in layer table records in
    the host drawing. But, if VISRETAIN is not set, then these records are not
    saved with the drawing so any changes you make are lost the next time the
    host is opened. Whereas if VISRETAIN is set, the records are saved with the
    drawing and any changes you make are there the next time the host is opened.

    The identification of xref layer table records in the host is done by layer
    name, so if the layer's name is changed in the xref, the xref mechanism in
    AutoCAD won't match the new name up with the old in the host drawing and any
    settings for that layer in the host will be lost.

    layers that should be frozen within said viewport; however, the linetype and
    color of the layer must be stored somewhere else. And yes, they definitely
    are stored somewhere, hence VISRETAIN. And maybe it would also keep old
    layer names, like the viewport object does, until the user purges?
    visibility properties of an xref'd layer when VISRETAIN is turned on? And if
    a layer within the xref is renamed, do the instructions for the old layer
    remain (like they do in a paperspace viewport entity) ?
     
    Art Cooney, Jul 17, 2004
    #18
  19. Glenn Harvey

    Glenn Harvey Guest

    I would rather avoid the layer state manager because I have a bunch of files
    to do.

    So VISRETAIN is set in our drawings, so we should be able to access xref
    layer table records ? So in theroy we should be able to change the colour of
    a xref'ed layer using VB, or C++ ? So can we also change the name of a
    xref'ed layer ?

    I just noticed that there was a VBA discussion group, should I put this post
    there?

    Thanks again to everyone for your help, we are getting close.
     
    Glenn Harvey, Jul 17, 2004
    #19
  20. Glenn Harvey

    Glenn Harvey Guest

    I would rather avoid the layer state manager because I have a bunch of files
    to do.

    So VISRETAIN is set in our drawings, so we should be able to access xref
    layer table records ? So in theroy we should be able to change the colour of
    a xref'ed layer using VB, or C++ ? So can we also change the name of a
    xref'ed layer ?

    I just noticed that there was a VBA discussion group, should I put this post
    there?

    Thanks again to everyone for your help, we are getting close.
     
    Glenn Harvey, Jul 18, 2004
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.