Author Topic: xref attribute work around  (Read 10632 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
xref attribute work around
« on: March 23, 2011, 09:47:40 AM »
Hi all,

I understand that xrefs do not support attributes.  We use our border sheet as an xref (company standard) and I would like to be able to call the sheet name into the layout tab name, This is to match our Revit printing naming standard.  (Revit forces the sheet name to the print and this now company standard)  My first idea was to use attributes but learned that attributes are not supported with xrefs.  I don't really want to assign an attribute to each sheet file because that defeats the purpose of attributes.

My idea now is to just make a plot reactor that asks the user to select the text in the border sheet that holds the sheet name and as long as it has been selected once it will keep the handle and check for name change each time it is plotted or re-ask to select the name if text is deleted.

If someone has a better solution I am open to ideas.

Simple solution would be to just have the user put in the correct name in the correct CAPs on or not wait till the last minute to just forget add the name and hold up print production. But this is not an option.

Thanks

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: xref attribute work around
« Reply #1 on: March 23, 2011, 10:03:54 AM »
My first suggestion would be to use an attributed block - but if this is really out of the question, you could perhaps attempt to grab the text from the block (xref) definition to avoid any user input and possible errors.

You can get all objects in a block using something like this:

Code: [Select]
(defun _getblockobjects ( name )
  (
    (lambda ( entity / result )
      (if entity
        (while (setq entity (entnext entity))
          (setq result (cons entity result))
        )
      )
    )
    (tblobjname "BLOCK" name)
  )
)

Code: [Select]
(_getblockobjects "YourBlockName")
The above could be easily modified to only return Text objects, from which you could grab your text.

Lee

T.Willey

  • Needs a day job
  • Posts: 5251
Re: xref attribute work around
« Reply #2 on: March 23, 2011, 10:23:59 AM »
You can use the code here to attach attributes to xrefs.

[ http://www.theswamp.org/index.php?topic=8037.msg371079#msg371079 ]
Tim

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

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: xref attribute work around
« Reply #3 on: March 23, 2011, 11:48:40 AM »
Ok, I did this once, pretty easy too.  Let me see if I can find it (many years ago . . ..)
James Buzbee
Windows 8

cadman6735

  • Guest
Re: xref attribute work around
« Reply #4 on: March 23, 2011, 01:40:59 PM »
Willey

Does your code attach an attribute to an xref as I would think a block would work?  So if I so choose to do so, when ever g-bs is xrefed into a new sheet file I will get the attribute dialog box to fill out the title border information Sheet Name, Sheet Number?  Ether at insert (as if I was inserting a block) or if I just double clicked on the border itself.

I am not looking for anyone to wright code for me, I am just looking for ideas and direction.  But if I could manipulate your code to what I think I want it to do, this would give me a great head start.  I tried to run you code to see what it does but it says I am missing some arguments.  It take me a bit to read and understand code to figure out what I am missing, so I am just curiouse where I can take your code

Thanks

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: xref attribute work around
« Reply #5 on: March 23, 2011, 01:58:45 PM »
OK, sorry, I don't have any of my really old stuff (only go back to 2007).

1. Xref the drawing WITH the attributes.
2. Change the name of the xref
3. Insert the drawing WITH the attributes.
4. Point the xref reference to the block.
5. Erase the original Xref entity

Can't remember how but it worked like a charm.

Let me see if I can remember any more . . ..
James Buzbee
Windows 8

cadman6735

  • Guest
Re: xref attribute work around
« Reply #6 on: March 23, 2011, 02:20:06 PM »
Buz

I almost see your logic, great trick

The only question I have is how do you point the xref to a block?

Following your logic
1. xrfed in my border sheet
2. changed the name
3. referenced in another bordersheet
4. bound the border sheet via insert
5. exploded the new inserted block to access the attribute
6. edit as a block
7. Block is no longer an xref...  (needs to remain xref)

I think I am missing some steps.  (not sure if I want to go this route but I do like the out of the box thinking.)
Please fill in the missing steps for me, I am super curiose.

Thanks

T.Willey

  • Needs a day job
  • Posts: 5251
Re: xref attribute work around
« Reply #7 on: March 23, 2011, 03:00:28 PM »
My code attaches an attribute to an insert.  The drawing would already have to be inserted into the drawing, and then you would run my code.  And xref is just a smart insert, so it works.
Tim

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

Please think about donating if this post helped you.

cadman6735

  • Guest
Re: xref attribute work around
« Reply #8 on: March 23, 2011, 04:00:54 PM »
Willey

Sorry man, I am still very green...  How do I run your code?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: xref attribute work around
« Reply #9 on: March 23, 2011, 04:38:14 PM »
I just tested it again in '09, and it seemed not to work.  When I get a minute I'll try it again and let you know.
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: xref attribute work around
« Reply #10 on: March 23, 2011, 04:50:30 PM »
Okay.  The new code worked in my latest test.
[ http://www.theswamp.org/index.php?topic=8037.msg426208#msg426208 ]

What you need to do is copy what is in the code block to a new file, save it, then load it into Acad.  Then type ' AddExtraAtt ' at the command line, and follow the prompts.  You have to hit ' T ' to type in the values to use though, but I just tied it, and it worked.
Tim

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

Please think about donating if this post helped you.

cadman6735

  • Guest
Re: xref attribute work around
« Reply #11 on: March 24, 2011, 09:52:43 AM »
wow, willey

This is a cool tool, thanks (it has given me an idea)

The only down side for what I am looking for is it seems that the att. will have to be added to each sheet, and for the users in my office this is way too many steps and just adding text to each sheet seems a simpler route.


The idea that I got from this is to setup a title border with attributs as you nomaly would in the title border file.  When the border is xrefed into the sheet file (I think it is called "deep cloning") deep clone the attributes into the sheet file and using your code somehow to attach the attributes to the xref block as your code does to become a true xref attribute.

So each time the border is referenced in I can attedit the title border xref block, sheet name and number.  Then when the plot is activeated a plot reactor will change the layout tab name to the attribute sheet number (A-101) and append the sheet name attribute to the Layout tab so when plotted I get (A-101 First Floor Plan)  or a command reactor that reacts on attedit and will rename the layout tab at that point.

Now this would be a trick.


I will post this code in a few years.  ^-^

cadman6735

  • Guest
Re: xref attribute work around
« Reply #12 on: March 24, 2011, 09:59:35 AM »
For right now I am trying to go the rought of just selecting text and storing the text in an object.

my code does not store the info once the file is closed, I know it is because I am losing my object after closing the file.  I am having a hard time figuring out how to select a text or mtext object with vlisp.

This is my first attemtp at this code:
Quote
  (defun c:get ( / ent entName entHandle)

  (vl-load-com)

    (setq
      ent      (entget (car (entsel)))
      entName      (cdr (car ent))
      entHandle      (cdr (assoc 5 (entget entName)))
    )

    (vlax-ename->vla-object entName)

    (vlax-ldata-put entName "Handle" entHandle)

    (princ)
)

;----------------------------------------------------------------------------------------------------------------------------------

  (defun c:put ( / )

  (vl-load-com)

  (print (vlax-ldata-get entName "Handle"))

    (princ)
)

can someone help me just select the text via vlisp.

thanks

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: xref attribute work around
« Reply #13 on: March 24, 2011, 10:01:23 AM »
Use nentsel.

cadman6735

  • Guest
Re: xref attribute work around
« Reply #14 on: March 24, 2011, 10:14:34 AM »
Lee

the text is not nested it is live in the file

I think we are thinking of two different approches.

We use only one border for each project with 200+ sheet, we that referance that one border file.  The text that never changes is located in the border file.  The sheet name and number will change per sheet file.  So at this point the only solution we know how to do is to leave the Number and Name blank in the border and just add text to each sheet.  Which has worked well for us until we switch to Revit.  Revit forces the PDF to print Sheet number and name, which upper managment loves.  Now we have a hard time getting users to fill out or rename the PDF's to match our new company standard.  Anyway, not to get into a long story.

So nentsel will not work unless I am way off base and don't understand the direction you are going.


Why does USERS1 not hold it value after closing file?