-XREF command does not allow name assignment like ZTopo=C:\topo.dwg

I've been using several lisps I normally uise in acad, for Bcad.

I ran accross the fact that the bcad -xref command does not allow the name (alias) to be specified before the path.

Is there a way to assign the alias on command line?

thanks

Comments

  • Please send us a SupportRequest, maybe with a little sample dwg ...
    also, _XREF command should work that way directly at the prompt, so Lisp
    is not needed to reproduce :-)

    Many greetings !
  • ok, did the request.

    Its actually a critical issue because you cannot attach the same drawing twice other than by changing the alias before its brought in. Maybe com or .net can do it as a workaround. thx

  • @Torsten,

    To use -XREF in this way you need to first set _FILEDIA = 0, otherwise it opens a file dialogue, which prevents you using this command line feature. These features hark back to the DOS days, when most things were still command line driven. As James has said you should be able to XREF in the same drawing file over and over using different aliases. e.g. In ACAD you would do and see something like this:

    Command: FILEDIA
    Enter new value for FILEDIA <1>: 0
    Command: -XREF
    Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] :
    Enter name of file to attach: MyXrefAlias=C:\Projects\Project Name\Drawings\Xrefs\MyXref.dwg

    Attach Xref "MyXrefAlias": C:\Projects\Project Name\Drawings\Xrefs\MyXref.dwg
    "MyXrefAlias" loaded.
    .
    .
    .
    .

    You also should be able to use the "~" to  invoke the file dialogue from the command line e.g.

    Command: -XREF
    Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] :
    Enter name of file to attach: MyOtherXrefAlias=~

    Attach Xref "MyOtherXrefAlias": C:\Projects\Project Name\Drawings\Xrefs\MyXref.dwg
    "MyXrefAlias" loaded.

    Attach Xref "MyOtherXrefAlias": C:\Projects\Project Name\Drawings\Xrefs\MyXref.dwg
    "MyOtherXrefAlias" loaded.
    .
    .
    .
    .

    I assume the lisp routine looks something like:
    [code](command "._-XREF" "_ATTACH" "MyXrefAlias=C:\\Projects\\Project Name\\Drawings\\Xrefs\\MyXref" "0,0" 1 1 0)
    (command "._-XREF" "_ATTACH" "MyOtherXrefAlias=C:\\Projects\\Project Name\\Drawings\\Xrefs\\MyXref"" "100,100" 1 1 0)[/code]

    In BricsCAD this doesn't work as it literally looks for the file name portion:
    [code](command "._-XREF" "_ATTACH" "MyXrefAlias=C:\\Projects\\Project Name\\Drawings\\Xrefs\\MyXref" "0,0" 1 1 0)
    : ._-XREF
    External References:  ? to list/Bind/Detach/Path/Reload/Unload/Overlay/: _ATTACH
    Select File to Attach: MyXrefAlias=C:\Projects\Project Name\Drawings\Xrefs\MyXref
    Unable to find requested file: "MyXrefAlias=C:\Projects\Project Name\Drawings\Xrefs\MyXref.dwg"[/code]

    Note these features first appeared with ._-INSERT, which performs somewhat better in BricsCAD. This will work
    [code](command "._-INSERT" "MyInsertAlias=C:\\CCL-Data\\CCL-Projects\\BCAD Forum\\XrefAlias\\MyXref" "0,0" 1 1 0)[/code]

    and this
    [code](command "._-INSERT" "~")[/code]

    But this doesn't
    [code](command "._-INSERT" "MyOtherInsertAlias=~")[/code]


    Regards,

    Jason Bourhill

    CAD Concepts


  • Dear Jason,

    yes, this is actually what should happn :-)
    -XREF and also (command "_xref" ...) do automatically switch to commandline version, FLEDIA=1
    is not necessary in these cases ... :-)

    It is -XREF commandline version, as you have shown, that should accept the Alias like -INSERT command
    does ... so thanks to James for the request ...

    Many greetings to all !
  • Hi Jason,

    Thanks for all the examples as I did not post it that clear. I am using it in a lisp command statement so filedia/cmddia can be left to 1. I have used acad since version 10 on DOS, so can still hit that tilda by reflex when needed :)

    I guess one workaround would be to attach a dummy file, then switch out path for same file as previously attached, if I wanted two of the same file attached.

    Or probably better, just rename 1st to add 1 on end or something, then dupe could just use filename.

    I have a lisp that attaches multiple xrefs, and it would check for existing xrefs of same name, and append 1 to alias if a dupe was found. I think I can create an xref programatically (not script style with command) so may be able to get around the issue that way.

    I will probably end up writing my own xref dialog too, as the behavior of the default one unloads and reloads items as you check them. That is bad for a production environment with large xrefs. You go to unload 5 or 6, and you get delays between each click, instead of one delay with an "apply" button. THat is my gripe with the acad modeless xref dialog too, so we use classicxref in acad....

    thanks all

  • Hi Jason,

    Thanks for all the examples as I did not post it that clear. I am using it in a lisp command statement so filedia/cmddia can be left to 1. I have used acad since version 10 on DOS, so can still hit that tilda by reflex when needed :)

    I guess one workaround would be to attach a dummy file, then switch out path for same file as previously attached, if I wanted two of the same file attached.

    Or probably better, just rename 1st to add 1 on end or something, then dupe could just use filename.

    I have a lisp that attaches multiple xrefs, and it would check for existing xrefs of same name, and append 1 to alias if a dupe was found. I think I can create an xref programatically (not script style with command) so may be able to get around the issue that way.

    I will probably end up writing my own xref dialog too, as the behavior of the default one unloads and reloads items as you check them. That is bad for a production environment with large xrefs. You go to unload 5 or 6, and you get delays between each click, instead of one delay with an "apply" button. THat is my gripe with the acad modeless xref dialog too, so we use classicxref in acad....

    thanks all

  • I had been wondering why people were posting messages two and three times, and here I got caught.

    You hit the post button, and it hangs for about 5 seconds. I thought I missed the pick so hit post again. Hence the two posts.

    Learned my lesson but wish the admin team could do something about that to avoid thread bloat with dupes. Maybe disable the post button once clicked.

    thx

  •  I have the same request, our lisp code used an alias for xrefs when attached. For now I'll have to rewrite the code as James mentioned.

    [code](command "_.-xref" attach_type (strcat bname "=" fullpath))[/code]

    Dan
  • I'm not sure why I didn't realize this before, but its super easy to work around this.

    Simply rename the block after xreffing, like:
        (COMMAND "-xref" "OVERLAY" PATH "0,0" "1" "" "0")
        (COMMAND "-RENAME" "BLOCK" (VL-FILENAME-BASE PATH) ALIAS)

    you could likely use entmod, com, .net... to do the same thing.

    I realized this worked as I had already written a routine to set all existing xrefs so that their alias started with Z.

  •  Unfortunately that doesn't work if the xref was already attached in a drawing, but as a nested xref so that you can't rename it. Unless you have an office standard that xrefs are always renamed automatically, then you never have a problem using the original name then renaming. Another thought I had is to xref a dummy file, then rename and repath to the one you want. But this doesn't allow preview of insertion using the normal command - except with perhaps more gymnastics. There are work arounds, just will take some time to code.
  • We deal with nested xrefs in two ways:

    1) They are not allowed on bases we create.

    2) our xref tool does automatically add a Z to the alias start, and its a good enough tool that people prefer it to adesk's and bdesk's (I just coined that term, roayalties required for all future use) tools.

    3) We have a "re-organize" tool that adds the Z to front of existing xrefs.

    4) if we get a base that must have attach xrefs, we use the re-org tool to add the Z.

    People used to resist the Z until I made the re-org tool. Then one click cleaned up the mess and off you go.

    You are right though, nested is untouchable, or until we write a dbx style tool to rename the blocks in an unopen dwg. Could be done.

  •  We use nested xrefs with xclipping a lot. For example to see the remainder of a lower level roof from an above floor. I like your system but for me the problem for reorganizing our existing projects is that the nest xref layering (screening / freezing) would be lost of the base xrefs get renamed. And I want to reimplement our xref renaming commands since we moved to BC.
  • btw, here is our tool.

    It uses doslib for muti-file selection, so you will need to get that. Its free.

    commands are:

    MXREF-SETS - settings

    MXREF - attach/overlay files

    RE-ORG-XREFS - fix layers and aliases to comply with settings.

    works on acad and bcad. enjoy.

    I think I see what you mean on the clipped xrefs, but forget how its handled. So if you rename an attached xref alias, the places where that is xreffed to treat it like something it has never seen? That would make sense as its the full layername - xref|layer - the sheet remembers.

    That seems too fragile to be the case, I need to test to belive it.

    mult-xref.lspMULT-XREF.DCL

This discussion has been closed.