Author Topic: What would you want in a set of Xref tools?  (Read 24520 times)

0 Members and 2 Guests are viewing this topic.

StykFacE

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #15 on: March 23, 2011, 12:25:21 PM »
My #1 request would be to have a OSNAP toggle for XREF's. Most of the time I'm working with an XREF, and I'm in a cluttered space, I don't want the OSNAPS from the architectural background interfering with what I am doing.

Not to degrade anyone's ability but would that even be possible?

*EDIT* Also, a quick way to update layer changes without having to set VISRETAIN to 0, reload, then set VISRETAIN back to 1, without losing the freezed/off layers in MS and PS Viewports. This might be too much of a personal request but still throwing it out there. No expectations on getting this, just contributing is all. ;)
« Last Edit: March 23, 2011, 12:33:30 PM by StykFacE »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #16 on: March 23, 2011, 12:30:45 PM »
I don't know.  While doing the other stuff, I'll look into the help files for Arx and see if it is possible.  Off the top of my head, I would say not possible, but I've been wrong before.
Tim

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

Please think about donating if this post helped you.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: What would you want in a set of Xref tools?
« Reply #17 on: March 23, 2011, 12:32:43 PM »
I don't know.  While doing the other stuff, I'll look into the help files for Arx and see if it is possible.  Off the top of my head, I would say not possible, but I've been wrong before.
try placing it inside an unselectable group
Be your Best


Michael Farrell
http://primeservicesglobal.com/

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #18 on: March 24, 2011, 11:12:54 AM »
*EDIT* Also, a quick way to update layer changes without having to set VISRETAIN to 0, reload, then set VISRETAIN back to 1, without losing the freezed/off layers in MS and PS Viewports. This might be too much of a personal request but still throwing it out there. No expectations on getting this, just contributing is all. ;)

Maybe there is code within this thread that will hold you over until I get this set of tools working.
[ http://www.theswamp.org/index.php?topic=8790.0 ]

I don't know.  While doing the other stuff, I'll look into the help files for Arx and see if it is possible.  Off the top of my head, I would say not possible, but I've been wrong before.
try placing it inside an unselectable group

I tried doing this with simple lines, and I couldn't get it to work correctly.  I don't use groups that much, but I remember that when you select one object within a group, it should select the whole group.  I couldn't even get that to work, not matter what value I used in ' PickStyle '.  Maybe you can give me a step by step process, or post a sample drawing setup correctly.
Tim

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

Please think about donating if this post helped you.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: What would you want in a set of Xref tools?
« Reply #19 on: March 24, 2011, 11:32:41 AM »
that fish don't swim...it should; only it doesn't work as I thought it would
Be your Best


Michael Farrell
http://primeservicesglobal.com/

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: What would you want in a set of Xref tools?
« Reply #20 on: March 24, 2011, 12:09:49 PM »
STRIP.  UNUSED.  ANNOSCALES.  FROM.  XREFS.

That shouldn't need any explanation.

Can you post a small test drawing?  I have not been able to create a problem drawing, as I don't use anno scales.

Wish I could, but wouldn't you know it I can't find one offhand.  Here's a quickie with a bunch of unused annotation scales in it.  XREF this into a 'clean' drawing and the XREF scales are added even though they are unnecessary and can be manually deleted.  Detach the XREF and they are still there and can still be deleted.

And yes, I *do* have annotation scale cleaners running automatically at drawing open, but there are a few problems.  Users keep using the reset option in the scale list editor or pointing to the OOTB AutoCAD DWT for the CleanAnnotationScales.EXE from AutoDesk, so their drawings end up with the *full* default list (yeah, yeah - management issue, but can't sit over everybodies shoulder every minute).  Once that gets down from the models to the ortho drawings, the list "takes too long" to clean out automatically every time the drawings are opened.  The ability to control the default list in 2011 will help a little bit but given our legacy files and how users love to cut'n'paste...

I would love to have a tool that can dip into the listed XREFs, find which annotation scales are actually in use, then allow those scales to be safely deleted in the host drawing.  Optionally, to dig into the XREF itself and yoink them from there and/or generate a one-shot data file that is read by the scale cleaner the next time the XREF itself is opened.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Jeff H

  • Needs a day job
  • Posts: 6150
Re: What would you want in a set of Xref tools?
« Reply #21 on: March 24, 2011, 06:19:14 PM »
My #1 request would be to have a OSNAP toggle for XREF's. Most of the time I'm working with an XREF, and I'm in a cluttered space, I don't want the OSNAPS from the architectural background interfering with what I am doing.

Not to degrade anyone's ability but would that even be possible?

You could probably do something with a PointMonitorEventHandler to check if FullSubentityPath[0] is the xref and if so turn off snaps then use something like PromptForSelectionEndingEventHandler for turning back on.

Not sure how efficent or well it work.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #22 on: March 25, 2011, 10:25:38 AM »
My #1 request would be to have a OSNAP toggle for XREF's. Most of the time I'm working with an XREF, and I'm in a cluttered space, I don't want the OSNAPS from the architectural background interfering with what I am doing.

Not to degrade anyone's ability but would that even be possible?

You could probably do something with a PointMonitorEventHandler to check if FullSubentityPath[0] is the xref and if so turn off snaps then use something like PromptForSelectionEndingEventHandler for turning back on.

Not sure how efficent or well it work.

Nice idea Jeff.  I was thinking it might be able to be done with transient graphics, but haven't done too much research yet.  Still in the thinking/planning phase.

@ dgorsman.... Thanks for the example.  I was able to figure some stuff out, but don't like the way it is working just yet.  I think it's a little slow, but it might be the only way.
Tim

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

Please think about donating if this post helped you.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: What would you want in a set of Xref tools?
« Reply #23 on: March 25, 2011, 10:40:21 AM »

Jeff H

  • Needs a day job
  • Posts: 6150
Re: What would you want in a set of Xref tools?
« Reply #24 on: March 25, 2011, 12:55:44 PM »
Need to use a different event to work a little smoother but basic concept.

Would not be hard to add be needs
1. Udate osnap settings if change after command is first run
2. Overlay
3. More than 1 xref
4 more

Again just simple impletation for testing and some ideas

Code: [Select]
         ObjectId xrefID;
        Object OsmodeSetting;
        [CommandMethod("XrefNoOsnaps")]
        public void XrefNoOsnaps()
        {

            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            Database db = doc.Database;
            using (Transaction trx = db.TransactionManager.StartTransaction())
            {
               
                BlockTable bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;


                foreach (ObjectId objId in bt)
                {
                    BlockTableRecord btr = objId.GetObject(OpenMode.ForRead) as BlockTableRecord;
                    //if (!(btr.IsLayout || btr.IsAnonymous || btr.IsFromExternalReference || btr.IsFromOverlayReference) && !(blocknames.Contains(btr.Name)))
                    if (btr.IsFromExternalReference)
                    {
                        ObjectIdCollection ObjIdColl = new ObjectIdCollection();
                        ObjIdColl = btr.GetBlockReferenceIds(true, false);

                        xrefID = ObjIdColl[0];
                        break;
                    }
                }

                trx.Commit();
            }

            OsmodeSetting = Application.GetSystemVariable("OSMODE");

            Application.DocumentManager.MdiActiveDocument.Editor.PointMonitor += new PointMonitorEventHandler(HoverHandler);
            Application.DocumentManager.MdiActiveDocument.Editor.PromptForSelectionEnding += new PromptForSelectionEndingEventHandler(HoverEndingHandler);

        }


        private void HoverEndingHandler(object sender, PromptForSelectionEndingEventArgs e)// PointMonitorEventHandler
        {
            Application.SetSystemVariable("OSMODE", OsmodeSetting);

       
        }

        private void HoverHandler(object sender, PointMonitorEventArgs e)// PointMonitorEventHandler
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;

            FullSubentityPath[] fsps = e.Context.GetPickedEntities();
            if (fsps.Length > 0)
            {
                FullSubentityPath fsp = fsps[0];

                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    try
                    {


                        if (fsp.GetObjectIds()[0] == xrefID)
                        {
                            Application.SetSystemVariable("OSMODE", 0);
                        }
                        else
                        {
                            Application.SetSystemVariable("OSMODE", OsmodeSetting);
                        }
                    }
                    catch
                    {
                        tr.Dispose();
                    }

                    tr.Commit();
                }
            }
           

        }



T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #25 on: March 25, 2011, 04:01:49 PM »
Thanks Jeff.  That did give me an idea to try.  Will see how it works.
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: What would you want in a set of Xref tools?
« Reply #26 on: March 25, 2011, 05:33:47 PM »
Didn't like the performance.  Here is the code I was testing.

Code: [Select]
public partial class XrefNoOsnaps : Form
{
private bool TurnOffOsnaps = true;
private object OldOsmode;
public XrefNoOsnaps()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
[CommandMethod( "testxros" )]
public void Main ()
{
Document Doc = AcadApp.DocumentManager.MdiActiveDocument;
if ( TurnOffOsnaps ) {
Doc.CommandWillStart += new CommandEventHandler( CmdStart );
Doc.CommandFailed += new CommandEventHandler( CmdStop );
Doc.CommandEnded += new CommandEventHandler( CmdStop );
Doc.CommandCancelled += new CommandEventHandler( CmdStop );
TurnOffOsnaps = false;
OldOsmode = AcadApp.GetSystemVariable( "OsMode" );
AcadApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage( "\n Added." );
}
else {
Doc.CommandWillStart -= new CommandEventHandler( CmdStart );
Doc.CommandFailed -= new CommandEventHandler( CmdStop );
Doc.CommandEnded -= new CommandEventHandler( CmdStop );
Doc.CommandCancelled -= new CommandEventHandler( CmdStop );
TurnOffOsnaps = true;
AcadApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage( "\n Removed." );
}
}

public void CmdStart ( object sender, CommandEventArgs cea )
{
OldOsmode = AcadApp.GetSystemVariable( "OsMode" );
AcadApp.DocumentManager.MdiActiveDocument.Editor.PointMonitor += new PointMonitorEventHandler( PtMon );
}

public void CmdStop ( object sender, CommandEventArgs cea )
{
AcadApp.DocumentManager.MdiActiveDocument.Editor.PointMonitor -= new PointMonitorEventHandler( PtMon );
}

public void PtMon ( object sender, PointMonitorEventArgs pmea )
{
Database Db = AcadApp.DocumentManager.MdiActiveDocument.Database;
FullSubentityPath[] fsp = pmea.Context.GetPickedEntities();
using ( Transaction Trans = Db.TransactionManager.StartTransaction() ) {
if ( fsp.Length == 0 ) {
if ( AcadApp.GetSystemVariable( "OsMode" ) == OldOsmode ) return;
else {
AcadApp.SetSystemVariable( "OsMode", OldOsmode );
Trans.Commit();
return;
}
}
foreach ( FullSubentityPath sp in fsp ) {
ObjectId[] Ids = sp.GetObjectIds();
if ( Ids.Length == 1 ) continue;
BlockReference BlkRef = Trans.GetObject( Ids[ 0 ], OpenMode.ForRead ) as BlockReference;
if ( BlkRef == null ) continue;
BlockTableRecord btr = Trans.GetObject( BlkRef.BlockTableRecord, OpenMode.ForRead ) as BlockTableRecord;
if ( !( btr.IsFromExternalReference || btr.IsFromOverlayReference ) ) continue;
AcadApp.SetSystemVariable( "OsMode", 0 );
Trans.Commit();
return;
}
}
AcadApp.SetSystemVariable( "OsMode", OldOsmode );
}
}
Tim

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

Please think about donating if this post helped you.

Rabbit

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #27 on: April 01, 2011, 01:04:38 PM »
This is very handy:

Code: [Select]
;;;Routine to change Xref layer color in host drawing.
(defun C:XLC ( / entlay)
  (setq entlay (cdr (assoc 8 (setq ent (entget (car (nentsel "Select an Xref-object to change layer color: ")))))))
  (setq entlayname (cdr (assoc 8 ent)))
  (if entlay
    (progn
      (if (vl-string-search "|" entlay)
        (progn
  (if (not XLCLayCol) (setq XLCLayCol "8"))
          (setq XLCLayCol (strcase (xgetstring (strcat entlayname
"\nCurrent Color: "
       (itoa (cdr (assoc 62 (entget (tblobjname "layer" entlay)))))
       " - New Color? ") XLCLayCol)))
          (command "._-layer" "C" XLCLayCol entlay "")
  entlay
        );progn
        (princ "\nThis is not an Xref!")
       );if
      );progn
    (alert "Nothing selected.")
   );if
);defun

barc

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #28 on: April 01, 2011, 01:48:33 PM »
A few years ago, using piles of borrowed code from africad (xtools) and some from here and a few other places I kinda slapped together some tools for attaching/overlaying multiple files at once, placing them on created layers named for the xref and other stuff.  It depended on doslib for the file dialog box dipsy-do which is okay IF you have the latest version of doslib.  I'd like something NOT based on doslib, that will allow something similar; 
example:
XAZ - attach multiple files selected from multiple directories at 0,0,0 and placed on a layer created for each xref.  Prefix the xref and layer names with "Z-"

Drawings CAT, DOG, and MONKEY are attached as Z-CAT, Z-DOG and Z-MONKEY and placed on layers Z-CAT, Z-DOG and Z-MONKEY respectively.

or maybe a single attach function that prompts for prefix if any .... hmmmm....

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: What would you want in a set of Xref tools?
« Reply #29 on: April 01, 2011, 02:01:37 PM »
A tool that sets the layer before attaching and xref.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans