Author Topic: Set Xref name equal to file name problem..  (Read 1264 times)

0 Members and 1 Guest are viewing this topic.

danglar

  • Newt
  • Posts: 161
  • Read My Li(s)(p)
Set Xref name equal to file name problem..
« on: October 26, 2015, 02:20:54 AM »
My frend sent me a routine that set xref name equal to flie name (see attached lisp). It working properly, but after invoke this programm it makes changes in layer colours of all reloaded xref's... Is it possible to set visretain variable programaticaly in order to remain all layer settings after invoke this programm.

Any help will be very appreciated

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Set Xref name equal to file name problem..
« Reply #1 on: October 26, 2015, 03:02:20 AM »
That code isn't changing the visretain. Do you mean your visretain is already 0 and you want to turn it to 1? If so add a line like this:

Code: [Select]
(setvar "visretain" 1)
Though IMO that doesn't really make sense ... i.e. if you have visretain=0 then you'd be loosing your layer settings all the time (every time you open the drawing or reload an xref). If you want to keep layer settings, then you need to have it set to 1 instead. 0 is meant to always read the layer settings from the original file, not changed in the containing file.

Which tells me there's a bug somewhere. Perhaps the rename & reload together is fudging the layer settings somehow. I've tested it on my Vanilla 2016 ACad and it seems as if this doesn't happen here. Could you please specify your ACad version?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

danglar

  • Newt
  • Posts: 161
  • Read My Li(s)(p)
Re: Set Xref name equal to file name problem..
« Reply #2 on: October 26, 2015, 04:08:15 AM »
Probably you are right... and in acad 2016 this bug not exist, but i and my frend use acad 2013 and this thing make sense...

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Set Xref name equal to file name problem..
« Reply #3 on: October 26, 2015, 04:31:52 AM »
Probably you are right... and in acad 2016 this bug not exist, but i and my frend use acad 2013 and this thing make sense...


OK, to test if it's an ACad bug (sorry I no longer have a copy of 2013 to do the test myself):
  • Type REN<space> in ACad's command line.
  • Select one of the xref blocks.
  • Give it a new name.
  • Click Rename & Close.
  • Open XRef manager, right-click on it and reload.
Does this retain your layer settings? If so, it seems it's something to do with the ActiveX libraries used in that code. If not, then there's a bug in 2013.


To get around this, you'd need to implement some form of manual layer-state restore. It may just be enough to save a layerstate and then restore it after the rename+reload code is run. But it may still have an issue due to the name changing, in which case you'd need to save the layer settings into a lisp variable and then restore them manually after the rename+reload (after altering for the new name).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

danglar

  • Newt
  • Posts: 161
  • Read My Li(s)(p)
Re: Set Xref name equal to file name problem..
« Reply #4 on: October 26, 2015, 05:47:35 AM »
Thank you for your help. I did all you requested and conclusion is - need to do something with the ActiveX libraries used in that code, but after that I changed

(vla-reload blk) to (command "-xref" "r" "*") and preset visretain to "1" and Miracle was happen - now it somehow working properly.. I don't now why:)