DBX lisp set xref draw orders

DBX lisp set xref draw orders

krzysztof.psujek
Advocate Advocate
3,138 Views
13 Replies
Message 1 of 14

DBX lisp set xref draw orders

krzysztof.psujek
Advocate
Advocate

Hi everyone,

is there a universal lisp or maybe some app from AU exchange to batch sort xrefs in every single drawing from folder?

The best would be app for which I could define xrefs draw order hierarchy (in .ini or .txt file) and then it will proceed with all drawings in picked folder.

 

It is just idea because my sheets prepared for batch plot consist only xrefs and titleblock and I noticed that any changes in one of xrefs are ruining my current draw order.

 

What is your way to manage draw order of xrefs?

One idea that I was interesting in was to set each xref to its separately unique layer and then operate layer draw order.

I could find on the forum or somewhere in the web functions or even routines to do it

for example written by @Lee_Mac or other lisp gurus.

 

Then I found this very interesting topic

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-export-xref-draw-order-for-a-...

 

it creates script file that I could run on many files. Nice idea.

But maybe there is another one smarter?

 

As I saw in few similar topics one of expert is @hmsilva 

so what is your method to manage xref draw order?

 

 

 

Sorry for my English.

Chris

 

 

 

 

 

 

 

 

0 Likes
Accepted solutions (1)
3,139 Views
13 Replies
Replies (13)
Message 2 of 14

john.uhden
Mentor
Mentor
Not that I can easily help you, but please explain further. Are you wishing to change the draworder of objects within an xref or just change the draworder of attached xrefs with respect to each other (and the title block)?

John F. Uhden

0 Likes
Message 3 of 14

krzysztof.psujek
Advocate
Advocate

Hi, thanks for reply.

Draw order only for references, not objects in it.
Generaly I wasn't precise.
I am in paper space and have defined layuots with titleblock and frame.
Each layout is in separate dwg file and Has same format (A3).
Inside the frame there is a viewport in which (in model space) I attached a couple of xrefs (depends of type of drawing... Is it plan, profile etc).
Some of references consist hatches, some of them main geometry with descriptions, others details...

So basicly I need sth that will help me with setting draw order only for references.
To make it the same in each drawing.and set right priority for example:
1. Group of References with main geometry should be always on front
2. Group of References with hatches always sent to back.
And so on.

Hope now It's clear.

Chris

 

Edit: It should be as reply to you @john.uhden but I posted it from mobile and sth gone wrong.

0 Likes
Message 4 of 14

john.uhden
Mentor
Mentor
I'm just guessing 'cause I've never used draworder within AutoLisp, but it
seems to me that if you could always name the xrefs in some alphabetic or
numeric order, then you could sort the list and use the draworder command
to keep sending the "oldest" ones to the back, leaving the "newest" in
front. Unfortunately you can't use (command) to edit a DBX file, but you
could use AutoLisp to keep opening the drawings in a folder and processing
each one the same way, saving each upon completion.

I once did a project for Philadelphia Gas Works to perform 23 operations on
over 13,000 dwgs in various subdirectories. It found and processed all of
them in only about 2.5 hours on a single Pentium 90 running just one
instance of AutoCAD. Oh, and with zero errors. Thank goodness for MDI.

John F. Uhden

0 Likes
Message 5 of 14

krzysztof.psujek
Advocate
Advocate

I am not following with you.

So you say that can run the same lisp routine through each drawing from my drawing folder, right?

 

It is worth to do it in that way in oposite to run a simple lisp from script file (batch run on whole folder)?

Will it be much faster?  

 

In both cases there is a need to open drawing, do some operations and then close with saving, it's time consuming operation.

I work on foreign servers and open simple sheet file ~1Mb size with few references takes me around 4-5min. 

 

I thought about DBX because there is no need to open drawing but beside that not commands allowed

there is also no possibility to operate with selection sets, that's makes it really hard. 

I think I will do this using script that will run simple lisp app.

 

I was curious if sb has quick method for that or maybe there is an application unknown for me. 

 

Chris

0 Likes
Message 6 of 14

patrick_35
Collaborator
Collaborator

Hi

 

I agree with @john.uhden it's complicated ObjectDBX. However, there may be the solution to copy / delete objects to create their own display order. In the old method.
Remains to be seen if there is no impact to change the handles (ObjectID)

 

@+

0 Likes
Message 7 of 14

dbroad
Mentor
Mentor
Accepted solution

It would be nice if you could attach a zip file with a basic drawing, with some objects in it and some basic xrefs and an idea of the order that you want to maintain and processes to replicate what you claim is a change in draw order.

 

You should also indicate which version of AutoCAD you are using.  ObjectDBX was one possible technique of batch processing drawings long ago but in the past 3 or 4 AutoCAD versions, the core console would be a more acceptable approach, which leaves the thumbnails of drawings intact and requires only simple scripting.

 

Long ago, there were big problems with the stability of draworder but I have not found, as you claim, that merely reloading an xref after modification changes the draw order.  A simple regenall restores most of the perceived draworder problems.  Managing draw order of 15 xrefs though would seem to be something that I never do.  I either want them all in the back or all in the front.  Generally, if I want them in the background, I screen them.

 

Do you have xrefs with a lot of raster images and wipeouts that need to mask one another in a certain order?

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 8 of 14

krzysztof.psujek
Advocate
Advocate

Hi,

I work with AutoCAD Civil3D 2015 sp3.

I did eTransmit but delete some large files. Also removed titleblock .

 

Draw order should be as listed in txt file (from most top into bottom)

 

BTW, it'is possible that ruining draw order I've noticed because I didn't do regenall at the end?

 

Anyway thanks for your effort.

Chris

 

 

0 Likes
Message 9 of 14

dbroad
Mentor
Mentor

When you etransmit, be sure to set all of your paths to relative so that it is possible to engage automatic repathing.

 

This is your desired order:

Xref name  Top to down order	
X10095KL	1
T10302LI	2
T20102UP	3
B1001402	4
S10193SZ	5
Z10094HV	6
Z10097GK	7
X100950A	8

 This is the current sortents extension dictionary attached to modelspace as accessed with getfulldraworder.  The last object in the list is supposed to be #1 in the draworder.

("S10193SZ" "B1001402" "X100950A" "Z10097GK" "X10095KL" "Z10094HV" "AecObjExplode_A3_Vport_EB" "T20102UP" "T10302LI")

 

 

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 10 of 14

john.uhden
Mentor
Mentor

I took a little look at my PGW code (which I can not share as it is their intellectual property). It is so complex that I would have to study it for a few days to be able to describe to you how it works. I don't know why that is; I finalized it only 12 years ago. Maybe it goes along with finding out recently that my bike riding has become a little wobbly. 😕

John F. Uhden

0 Likes
Message 11 of 14

krzysztof.psujek
Advocate
Advocate

I've just copied random file from server to local drive and then all relative path gone. Normally it is set in such way.

I haven't checked its references order I treat it as example for tests.

 

I will do some tries with core console and scripts, to be honest I haven't experiment with this before.

I mean script that will run simple lisp routine to set right order.

 

And then let you know if it satisfy me, (think it should).

Temporary have to focus on other thing at work so probably I will try it at home or back to it in a couple of day.

 

Thanks for all suggestions @john.uhden first I will follow with @dbroad advices.

 

Chris

0 Likes
Message 12 of 14

krzysztof.psujek
Advocate
Advocate

Hi, again

basically I've got such simple routine and I will run it on all drawings in folder.

 

My files looks as below.

LSP:

 

;; GETXR_ORDER
;; here define xref order from top to bottom
(defun get_order (/ rs)
  (setq rs '("X10095KL" "T10302LI"  "T20102UP" "T20202UP" "T22202UP" "T20302UP"  "B1001402" "S10193SZ" "S10293SZ" "S12293SZ" "S10393SZ" "Z10097GK" "Z10094HV" "X100950A" ))		  	    		    
)
;; SORT XREFS   
(defun xreforder (/ xo ss)
(setvar 'cmdecho 0)
  (setvar 'tilemode 1)
  (setq xo (get_order))
  (foreach obj xo
    (if	(setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 obj))))
      (command "_.draworder" ss "" "_b")
    )
  )
  (setvar 'cmdecho 1)
  (setvar 'tilemode 0)
  (princ)
)(princ)

(defun c:xro nil (xreforder))

 

BAT:

 

FOR %%f IN ("c:\Test\*.dwg") DO "C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe" /i "%%f" /s "c:\Test\xrsort.scr" /l en-US

  

SCR:

 

FILEDIA 0
CMDDIA 0
(load "D:\\_CAD\\Lisp\\xro_DRAWORDER_XR.lsp")
XRO
FILEDIA 1
CMDDIA 1
QSAVE

It works and it is quite fast :), and I could start a few others operations on other projects folders at once. Awesome!

If sb interesting in knowledge about CoreConsole I found here:

CoreConsole

 

Thank you very much @dbroad 

Regards, 

Chris

Message 13 of 14

dbroad
Mentor
Mentor
Glad to help. Keep lisping.
Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 14 of 14

bchanlem
Explorer
Explorer

hey to update this bat so that it works on civil3d 2022 id just have to change the app link on my computer correct?

 

what would i have to do to the batch file to  add a prompt and input for the folder that contains all the final sheets  i want to run this LSP on?

0 Likes