TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Jeff_M on April 05, 2006, 05:59:53 PM

Title: For Wyatt Earp, draworder attributes
Post by: Jeff_M on April 05, 2006, 05:59:53 PM
This is a continuation of a PM I received, I felt it best done in the public's view.
"....so I need to know is there an easy to use VLSP to make a selection set of the (0 . "attrib") - All I am looking to do if "grab" them all and then sort a display order when embedded in an XREF. I'm using R2006."
<snipped out the code>

AFAIK......
Attribute references cannot be obtained by a selection set, nor can their Draworder be changed independently of the insert they are attached to. You cannot select objects, of any type, within Xrefs to be used in the Draworder.

I don't know if the problem in R2002 of Xref's Draworder not being recognized has been fixed in 2006, but if it has then adjust the Xref drawing before importing into the parent drawing.

If anyone knows anything that says I'm wrong about these things, I'd be happy to hear it.
Title: Re: For Wyatt Earp
Post by: Wyatt Earp on April 05, 2006, 06:14:04 PM
Well, yes you can get objects to do that in R2006. I'm trying to get a selection set of Attributes of blocks listed in a drawing so that I can bring them above wipeouts.

It is just a matter of draworder which I am trying to automate.
Title: Re: For Wyatt Earp
Post by: Jeff_M on April 05, 2006, 06:38:05 PM
OK, if you can describe how you'd do this via the command line then I could probably figure out the automate part.

I tried the Draworder in 2006 and was unable to select an attribute to bring forward, the entire block insertion gets selected
Title: Re: For Wyatt Earp
Post by: Jürg Menzi on April 06, 2006, 07:32:36 AM
You can't modify attributes by draworder command or by vlisp method (sortents table)... :-(
Title: Re: For Wyatt Earp, draworder attributes
Post by: Wyatt Earp on April 06, 2006, 05:10:03 PM
Well here's the code I came up with:

Code: [Select]
(defun C:xBack ()

  (setq xb1 (ssget "X"
   (list (cons 0 "insert")
(cons 8 "_xref")
   )
    )
  )
  (setq xb2a (ssget "X"
   (list (cons 0 "insert")
(cons 8 "_sym03")
   )
    )
  )
  (setq xb2c (ssget "X"
   (list (cons 0 "insert")
(cons 8 "_sym05")
   )
    )
  )
  (setq xb3 (ssget "X"
   (list (cons 0 "mtext") )
   )
)
  (setq xb4 (ssget "X"
   (list (cons 0 "dimension")
)
   )
)
  (setq xb5 (ssget "X"
   (list (cons 0 "wipeout")
)
   )
)

  (if xb1
    (progn
      (command "draworder" xb1 "" "b")
      (command "regenall")
      (princ "\nAll Xrefs Have Been Moved Back... ")
    )
  )
  (if xb3
    (progn
      (command "draworder" xb3 "" "f")
      (command "regenall")
      (princ "\nAll Text Objects Have Been Moved Forward... ")
      )
    )
  (if xb4
    (progn
      (command "draworder" xb4 "" "f")
      (command "regenall")
      (princ "\nAll Dimension Objects Have Been Moved Forward... ")
      )
    )
 
  (if xb5
    (progn
;(command "draworder" xb5 "" "a" xb1 "")
        (command "draworder" xb5 "" "u" xb2a "")
        ;(command "draworder" xb5 "" "u" xb2-shape "")
        (command "draworder" xb5 "" "u" xb2c "")
        (command "draworder" xb5 "" "u" xb3 "")
        (command "draworder" xb5 "" "u" xb4 "")
        (command "regenall")
(princ
  "\nAll Wipeout Objects Have Been Moved Accordingly... "
)
      )
    ;)
  )
  (princ)
  (setq xb1 nil
xb2a nil
xb2-shape nil
xb2c nil
xb2 nil
xb3 nil
xb4 nil
xb5 nil
)
)

What I'm trying to do is generate a series of selection sets and then to with a single command move the visual content applicably. Alternately I've also thought about creating groups around everything that we do in the office so that the group can be moved accordingly - trouble is I'm not sure how to automate that mess... Ideas?

Thanks guys



<Code tags Added - CAB>
Title: Re: For Wyatt Earp, draworder attributes
Post by: whdjr on April 06, 2006, 05:30:36 PM
In reference to xrefs my comment doesn't work but in reference to blocks what we do to workaround draworder is to 'CUT' and 'PASTE' the blocks in the desired order.  This gives the desired effect of draworder.  What this does is adds the blocks to database last therefore they are on top.