Resetting insertion point

Discussion in 'AutoCAD' started by Cad_Girl, Jul 1, 2004.

  1. Cad_Girl

    Cad_Girl Guest

    Anyone know how I can just select an already inserted xref and change its values so that the insertion point is 0,0 and its rotation is 0 degrees?
    Got a drawing with lots of xrefs attached but for some reason have been moved and rotated. I need to get them back to original co-ords. Don't fancy reloading all as this will change my layer state.
    Thanks.
    Cad_girl
     
    Cad_Girl, Jul 1, 2004
    #1
  2. Cad_Girl

    Tom Smith Guest

    Simply select the xref and use Properties to change its insertion point and
    rotation.

    However, this won't fix it if the xref's internal geometry has changed -- if
    it has been moved or rotated relative to its own origin.

    If visretain is set to 1, doing an xref reload will not change layer states
    in the referencing drawing. This will only happen if you detach and reattach
    the xref.

    However, reloading the xref isn't going to change anything unless the xref
    has changed since you opened the referencing drawing. A "reload" happens
    every you bring open the drawing containing the xref.
     
    Tom Smith, Jul 1, 2004
    #2
  3. Assoc/dxf code 10 is the insertion point, 50 is the rotation angle (in
    radians, but if you're going to change it to zero, it doesn't matter).

    You could entmod/entupd those values for the selected entity. Or (since I
    don't remember the right grammar for entupd/entmod without looking it up,
    but I do for the following), you could do something like this (in menu
    item/button format):

    [XrefToZeros](setq xrefreorient (entsel)) \+
    (setq xrefassoc (entget (car xrefreorient))) +
    MOVE !xrefreorient ;+
    (cdr (assoc 10 xrefassoc)) 0,0 +
    ROTATE P ;0,0 R (cdr (assoc 50 xrefassoc)) 0

    Kent Cooper, AIA

    values so that the insertion point is 0,0 and its rotation is 0 degrees?
    moved and rotated. I need to get them back to original co-ords. Don't fancy
    reloading all as this will change my layer state.
     
    Kent Cooper, AIA, Jul 1, 2004
    #3
  4. Cad_Girl

    James Allen Guest

    Something like this?

    (setq obj (vlax-ename->vla-object (car (entsel))))
    (vla-put-insertionpoint obj (vlax-3d-point '(0 0 0)))
    (vla-put-rotation obj 0)
    (setq obj nil)

    I suspect Tom's comments address your real issue though.
     
    James Allen, Jul 1, 2004
    #4
  5. Cad_Girl

    Tom Smith Guest

    Assoc/dxf code 10 is the insertion point....

    Don't need a lisp to change Properties, they're easily available. But this
    may not be relevant anyway, as I explained. In all likelihood the xrefs
    themselves have changed, so they no longer respect a common coordinate
    system.
     
    Tom Smith, Jul 1, 2004
    #5
  6. Cad_Girl

    Cad_Girl Guest

    Cheers Guys,
    Both sound good but how do I get thim into lisp to work? :eek:(

    Cad_Girl
     
    Cad_Girl, Jul 1, 2004
    #6
  7. No, you don't *need* a lisp routine, but if you do a lisp menu item or defun
    a command to do it, you can just invoke that and pick on the Xref, and those
    properties will all be changed instantly for you, which is a lot easier than
    picking the Xref, then picking the various places in the Properties dialog
    box and changing the insertion point (maybe in all three axes) and rotation
    all to zero (especially if you have many to do in the same drawing).

    My routine and James's should do what Cad_girl originally asked, but you're
    absolutely right that if the problem is something changed in the source
    drawings, the routines won't "fix" that for her. She'd have to get into
    those and fix them, and who knows what kinds of things would have to be
    done? Probably different things in different drawings.

    Maybe it's likely that the problem is in the source drawings, because as she
    said, "for some [obviously unknown] reason [the Xref's] have been moved and
    rotated." How that is likely to happen in the target drawing is a little
    hard to imagine, but maybe it's just as possible as that the source drawings
    are changed. I would suspect things were moved in the source drawings if it
    was only the position that came out wrong in the target drawing, but I'm
    less inclined to suspect that source drawing changes are at fault if things
    are rotated, too.

    If she applies one of those suggested routines, or even just tries changing
    a few with the Properties dialog box, it should be pretty instantly obvious
    which type of problem she has.

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Jul 1, 2004
    #7
  8. With a little exploring of the Menu area in Help / Customization Guide (the
    exact headings vary in different releases), you should be able to stick
    either of them into a pull-down or screen or tablet menu item. I haven't
    worked with VLA, so I'm not sure whether James's would work that way, but if
    so it would need plus signs added to connect the lines together, and maybe a
    backslash for user selection after the first line, and a heading added for
    the pull-down or screen variety.

    With a little more exploring, you can use (defun) to turn them into a
    command, which has the advantage that after you call it up, you can just hit
    Enter to do it again, rather than having to go to the menu item again,
    wherever that might be. Mine would have to be formatted differently in
    several places for that, using the (command) function in place of the simple
    macro-command approach, and putting quotation marks around certain things,
    and eliminating the exclamation point.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Jul 1, 2004
    #8
  9. Cad_Girl

    Tom Smith Guest

    Before programming, try Properties first to see if this even affects the
    problem.

    The lisp is not modifying anything that you can't access through the
    Properties dialog -- simple everyday object properties. If modifying
    properties fixes things, then you could put it on a button or whatever. You
    could accomplish the same through a menu macro running the chprop command.
     
    Tom Smith, Jul 1, 2004
    #9
  10. Actually, the insertion point and rotation angle are not properties that can
    be changed in Chprop. See the ones you can in its after-selection prompt.

    Kent Cooper, AIA


    command.
     
    Kent Cooper, AIA, Jul 1, 2004
    #10
  11. Cad_Girl

    Tom Smith Guest

    Actually, the insertion point and rotation angle are not properties that
    can
    Sorry. Old-fashioned CHANGE will work.
     
    Tom Smith, Jul 1, 2004
    #11
  12. Cad_Girl

    no.name Guest

    (DEFUN cadgirl:xreflir
    (lock-mode
    insertion-mode
    rotation-mode
    /
    *acad-object*
    *activedocument*
    cadgirl:acad-object
    cadgirl:activedocument
    cadgirl:get-layers
    cadgirl:get-blocks
    cadgirl:rtd
    cadgirl:layerthaw
    cadgirl:layerunlock
    cadgirl:layeron
    cadgirl:layeradd
    cadgirl:lockmode
    cadgirl:insertionmode
    cadgirl:rotationmode
    sset
    sset-count
    sset-index
    entityname
    xref-obj
    xref-name
    xref-layer
    )
    ;| |;
    (VL-LOAD-COM)
    (SETQ *acad-object* nil)
    (SETQ *activedocument* nil)
    (DEFUN cadgirl:acad-object () (SETQ *acad-object* (VLAX-GET-ACAD-OBJECT)))
    (DEFUN cadgirl:activedocument () (SETQ *activedocument*
    (VLA-GET-ACTIVEDOCUMENT (cadgirl:acad-object))))
    (DEFUN cadgirl:get-layers () (VLA-GET-LAYERS (cadgirl:activedocument)))
    (DEFUN cadgirl:get-blocks () (VLA-GET-BLOCKS (cadgirl:activedocument)))
    (DEFUN cadgirl:rtd (radian) (* 180 (/ radian PI)))
    (DEFUN cadgirl:layerthaw (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-TRUE (VLAX-GET-PROPERTY layer "freeze"))
    (PROGN (VLAX-PUT-PROPERTY layer "freeze" :VLAX-FALSE)
    (VLA-REGEN (cadgirl:activedocument) ACALLVIEWPORTS)
    )
    )
    )
    (DEFUN cadgirl:layerunlock (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-TRUE (VLAX-GET-PROPERTY layer "lock"))
    (VLAX-PUT-PROPERTY layer "lock" :VLAX-FALSE)
    )
    )
    (DEFUN cadgirl:layeron (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-FALSE (VLAX-GET-PROPERTY layer "layeron"))
    (VLAX-PUT-PROPERTY layer "layeron" :VLAX-TRUE)
    )
    )
    (DEFUN cadgirl:layeradd (layername)
    (IF (NOT (TBLSEARCH "layer" layername))
    (VLA-ADD (cadgirl:get-layers) layername)
    )
    )
    (DEFUN cadgirl:lockmode (layername)
    (IF lock-mode
    (VLAX-PUT-PROPERTY (VLA-ITEM (cadgirl:get-layers) layername) "lock"
    :VLAX-TRUE)
    (VLAX-PUT-PROPERTY (VLA-ITEM (cadgirl:get-layers) layername) "lock"
    :VLAX-FALSE)
    )
    )
    (DEFUN cadgirl:insertionmode (xref / objinsertionpoint variantvalue point
    sa-make sa-fill sa)
    (IF insertion-mode
    (PROGN (SETQ objinsertionpoint (VLAX-GET-PROPERTY xref
    'insertionpoint))
    (SETQ variantvalue (VLAX-VARIANT-VALUE objinsertionpoint))
    (SETQ point (VLAX-SAFEARRAY->LIST variantvalue))
    (IF (NOT (EQ point '(0.0 0.0 0.0)))
    (PROGN (SETQ sa-make (VLAX-MAKE-SAFEARRAY VLAX-VBDOUBLE '(0 .
    2)))
    (SETQ sa-fill (VLAX-SAFEARRAY-FILL sa-make '(0 0 0)))
    (VLAX-SAFEARRAY->LIST sa-fill)
    (SETQ sa (VLAX-MAKE-VARIANT sa-fill))
    (VLAX-PUT-PROPERTY xref 'insertionpoint
    (VLAX-MAKE-VARIANT sa))
    )
    )
    )
    )
    )
    (DEFUN cadgirl:rotationmode (xref / objrotation)
    (IF rotation-mode
    (PROGN (SETQ objrotation (VLAX-GET-PROPERTY xref 'rotation))
    (IF (/= 0 (cadgirl:rtd objrotation))
    (VLAX-PUT-PROPERTY xref 'rotation 0)
    )
    )
    )
    )
    ;| main |;
    (VLA-STARTUNDOMARK (cadgirl:activedocument))
    (VLAX-FOR each (cadgirl:get-blocks) ;| |;
    (IF (= (VLA-GET-ISXREF each) :VLAX-TRUE) ;| |;
    (IF ;| if ssget is successful, xref is not nested |;
    (SETQ sset (SSGET "X" (LIST (CONS 0 "INSERT") (CONS 2 (VLA-GET-NAME
    each))))) ;| get selection set of xref |;
    (PROGN (SETQ sset-count (1- (SSLENGTH sset))) ;| -1 the length
    cause first index in sset is 0 |;
    (SETQ sset-index 0) ;| first in sset |;
    (WHILE (<= sset-index sset-count) ;| while index is <= count
    |;
    (PROGN ;| |;
    (SETQ entityname (SSNAME sset sset-index)) ;| entity
    name |;
    (SETQ xref-obj (VLAX-ENAME->VLA-OBJECT (SSNAME sset
    sset-index))) ;| convert to vla |;
    (SETQ xref-name (STRCASE (VLAX-GET-PROPERTY xref-obj
    'name))) ;| get name of xref |;
    (SETQ xref-layer (STRCASE (VLAX-GET-PROPERTY xref-obj
    'layer))) ;| get xrefs current layername |;
    (IF (/= xref-name xref-layer) ;| if xrefs name does not
    equal layername |;
    (PROGN ;(PRINC " xref name & layer name NOT equal
    \n\n")
    (cadgirl:layerthaw xref-layer) ;| thaw xrefs current
    layer |;
    (cadgirl:layeron xref-layer) ;| turn on xrefs
    current layer |;
    (cadgirl:layerunlock xref-layer) ;| unlock xrefs
    current layer |;
    (cadgirl:layeradd xref-name) ;| add new layer if
    needed |;
    (cadgirl:layerunlock xref-name) ;| make sure xrefs
    new layer is unlocked |;
    (VLAX-PUT-PROPERTY xref-obj 'layer xref-name) ;| put
    xref on its new named layer |;
    (cadgirl:insertionmode xref-obj) ;| check insertion
    point |;
    (cadgirl:rotationmode xref-obj) ;| check rotation |;
    (cadgirl:lockmode xref-name) ;| lock/unlock xrefs
    layer |;
    ) ;| end PROGN |;
    (PROGN ;(PRINC " xref name & layer name EQUAL
    \n\n")
    (cadgirl:layerthaw xref-layer) ;| thaw xrefs current
    layer |;
    (cadgirl:layeron xref-layer) ;| turn on xrefs
    current layer |;
    (cadgirl:layerunlock xref-layer) ;| unlock xrefs
    current layer |;
    (cadgirl:insertionmode xref-obj) ;| check insertion
    point |;
    (cadgirl:rotationmode xref-obj) ;| check rotation |;
    (cadgirl:lockmode xref-name) ;| lock/unlock xrefs
    layer |;
    ) ;| end PROGN |;
    ) ;| end IF |;
    ) ;| end PROGN |;
    (SETQ sset-index (1+ sset-index)) ;| increment index |;
    ) ;| end WHILE |;
    ) ;| end PROGN |;
    ;(PRINC (STRCAT (VLA-GET-NAME each) " is NESTED xref \n")) ;| if ssget is
    not successful, xref is nested |;
    );| end IF |;
    ) ;| end IF |;
    ) ;| end VLAX-FOR |;
    (VLA-ENDUNDOMARK (cadgirl:activedocument))
    (PRINC)
    ) ;| end DEFUN |;


    (DEFUN c:xr-layer ()
    (cadgirl:xreflir nil nil nil)
    )
    ;;;(PRINC "\n\n ' XR-LAYER ' xrefs to named layer")

    (DEFUN c:xr-rot ()
    (cadgirl:xreflir nil nil T)
    )
    ;;;(PRINC "\n\n ' XR-ROT ' xrefs to zero rotation")

    (DEFUN c:xr-ins-rot ()
    (cadgirl:xreflir nil T T)
    )
    ;;;(PRINC "\n\n ' XR-INS-ROT ' xrefs to 0,0,0 & zero rotation ")

    (DEFUN c:xr-lock-ins-rot ()
    (cadgirl:xreflir T T T)
    )
    ;;;(PRINC "\n\n ' XR-LOCK-INS-ROT ' xrefs to locked layer, 0,0,0, & zero
    rotation")

    (DEFUN c:xr-lock-ins ()
    (cadgirl:xreflir T T nil)
    )
    ;;;(PRINC "\n\n ' XR-LOCK-INS ' xrefs to locked layer & 0,0,0")

    (DEFUN c:xr-lock ()
    (cadgirl:xreflir T nil nil)
    )
    ;;;(PRINC "\n\n ' XR-LOCK ' xrefs to locked layer")

    (DEFUN c:xr-ins ()
    (cadgirl:xreflir nil T nil)
    )
    ;;;(PRINC "\n\n ' XR-INS ' xrefs to 0,0,0")

    (PRINC)
     
    no.name, Jul 1, 2004
    #12
  13. Cad_Girl

    James Allen Guest

    Agreed. Until we know for sure what the problem is, we could be programming
    something totally useless. Thank you Tom.

    James
     
    James Allen, Jul 1, 2004
    #13
  14. Cad_Girl

    Tom Smith Guest

    I would suspect things were moved in the source drawings if it
    Who knows? As you say, it's easy enough to check.

    I'm not against programming to expedite a repetitive task. But I'm in favor
    of doing the quick/free/built-in check first to see if the proposed
    programming task even addresses the situation at all.

    People do all manner of goofy things with coordinate systems, per the
    frequent discussions in the CAD manager's NG. When she says she "gets"
    drawings in which the xrefs have been scrambled, it's hard to picture a
    person deliberately assembling such a mess on-screen and then presenting it
    to her. When she says "have been moved and rotated" it implies that the
    source xrefs were once properly assembled in the target drawing, but now
    aren't.

    The only possibilities seem to be a) a person made mincemeat of the target
    drawing, looked at it and inexplicably decided that was fine, and saved it
    in that fashion, or b) one or more people independently working in the
    source drawings did odd things which may not have been apparent because they
    were using a shifted or rotated UCS, and the change in geometry didn't show
    up until the unmodified target drawing was opened again. I lean toward the
    latter guess, but either scenario indicates sloppy drafting practice (or
    lack of training) which needs to get corrected.
     
    Tom Smith, Jul 1, 2004
    #14
  15. Cad_Girl

    Cad_Girl Guest

    Looks like I need clarify this!!! Sorry!!
    I work in a multi-disciplinary office. Archs and Struct Engs. I'm a Struct Eng (well, draughy). But I also help out with Arch work as they're not to bright on CAD (not ALL Archs, just ours!).
    We have a huge project on right now. The Archs did all their drawings before we had site info - not quite sure how - so all models were not in "real co-ords". But they are now.
    However, some bright spark in our dept - not me - decided to do global move of ALL entities in our drawings to move to the correct co-ords. This included the xrefs. There are alot of xrefs in each one of our drawings.
    So what I need to do is globally reset the xrefs to 0,0,0 with rotation to 0. That way everything matches up. Yes, I can use properties but there are lots of xrefs, so I was hoping I could globally change the lot, per drawing. Many xrefs have layers frozen after import, and I know that just by moving the xref, the layer state wont change.
    Hope this is more helpful!!

    Cad_Girl
     
    Cad_Girl, Jul 1, 2004
    #15
  16. Cad_Girl

    no.name Guest

    try this from the previous post

    (DEFUN c:xr-ins-rot ()
    (cadgirl:xreflir nil T T)
    )
    ;;;(PRINC "\n\n ' XR-INS-ROT ' xrefs to 0,0,0 & zero rotation ")
     
    no.name, Jul 1, 2004
    #16
  17. Cad_Girl

    James Allen Guest

    Perhaps we're missing something... Can't you use properties on the whole
    lot? If you're on a2k2 or higher (maybe lower than that, can't remember)
    then you should be able to change all of their properties together in the
    properties window.

    James
     
    James Allen, Jul 1, 2004
    #17
  18. Cad_Girl

    Cad_Girl Guest

    Yes you're right. Suppose I'm just being lazy really!
    But was hoping there was a way to maybe do it by a single command, rather that trying to find and select each xref (not knowing how many there were in each dwg) and changing 4 lots of values.
    Just thought there might have been an easier way!!

    Cad_girl x
     
    Cad_Girl, Jul 1, 2004
    #18
  19. Sounds like a better way for multiple Xref's than my or your earlier
    routines, which both require selecting each Xref and moving/rotating them
    one at a time, even if they do accomplish both of those at once for a given
    Xref.

    no.name's tome is pretty scary looking, but if it does every Xref at one
    blow, it would be even easier.

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Jul 1, 2004
    #19
  20. Cad_Girl

    no.name Guest

    seriously, try it: this version shouldn't change the xref's current layer

    (DEFUN cadgirl:xreflir
    (lock-mode
    insertion-mode
    rotation-mode
    /
    *acad-object*
    *activedocument*
    cadgirl:acad-object
    cadgirl:activedocument
    cadgirl:get-layers
    cadgirl:get-blocks
    cadgirl:rtd
    cadgirl:layerthaw
    cadgirl:layerunlock
    cadgirl:layeron
    cadgirl:layeradd
    cadgirl:lockmode
    cadgirl:insertionmode
    cadgirl:rotationmode
    sset
    sset-count
    sset-index
    entityname
    xref-obj
    xref-name
    xref-layer
    )
    ;| |;
    (VL-LOAD-COM)
    (SETQ *acad-object* nil)
    (SETQ *activedocument* nil)
    (DEFUN cadgirl:acad-object () (SETQ *acad-object* (VLAX-GET-ACAD-OBJECT)))
    (DEFUN cadgirl:activedocument () (SETQ *activedocument*
    (VLA-GET-ACTIVEDOCUMENT (cadgirl:acad-object))))
    (DEFUN cadgirl:get-layers () (VLA-GET-LAYERS (cadgirl:activedocument)))
    (DEFUN cadgirl:get-blocks () (VLA-GET-BLOCKS (cadgirl:activedocument)))
    (DEFUN cadgirl:rtd (radian) (* 180 (/ radian PI)))
    (DEFUN cadgirl:layerthaw (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-TRUE (VLAX-GET-PROPERTY layer "freeze"))
    (PROGN (VLAX-PUT-PROPERTY layer "freeze" :VLAX-FALSE)
    (VLA-REGEN (cadgirl:activedocument) ACALLVIEWPORTS)
    )
    )
    )
    (DEFUN cadgirl:layerunlock (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-TRUE (VLAX-GET-PROPERTY layer "lock"))
    (VLAX-PUT-PROPERTY layer "lock" :VLAX-FALSE)
    )
    )
    (DEFUN cadgirl:layeron (layername / layer)
    (SETQ layer (VLA-ITEM (cadgirl:get-layers) layername))
    (IF (= :VLAX-FALSE (VLAX-GET-PROPERTY layer "layeron"))
    (VLAX-PUT-PROPERTY layer "layeron" :VLAX-TRUE)
    )
    )
    (DEFUN cadgirl:layeradd (layername)
    (IF (NOT (TBLSEARCH "layer" layername))
    (VLA-ADD (cadgirl:get-layers) layername)
    )
    )
    (DEFUN cadgirl:lockmode (layername)
    (IF lock-mode
    (VLAX-PUT-PROPERTY (VLA-ITEM (cadgirl:get-layers) layername) "lock"
    :VLAX-TRUE)
    (VLAX-PUT-PROPERTY (VLA-ITEM (cadgirl:get-layers) layername) "lock"
    :VLAX-FALSE)
    )
    )
    (DEFUN cadgirl:insertionmode (xref / objinsertionpoint variantvalue point
    sa-make sa-fill sa)
    (IF insertion-mode
    (PROGN (SETQ objinsertionpoint (VLAX-GET-PROPERTY xref
    'insertionpoint))
    (SETQ variantvalue (VLAX-VARIANT-VALUE objinsertionpoint))
    (SETQ point (VLAX-SAFEARRAY->LIST variantvalue))
    (IF (NOT (EQ point '(0.0 0.0 0.0)))
    (PROGN (SETQ sa-make (VLAX-MAKE-SAFEARRAY VLAX-VBDOUBLE '(0 .
    2)))
    (SETQ sa-fill (VLAX-SAFEARRAY-FILL sa-make '(0 0 0)))
    (VLAX-SAFEARRAY->LIST sa-fill)
    (SETQ sa (VLAX-MAKE-VARIANT sa-fill))
    (VLAX-PUT-PROPERTY xref 'insertionpoint
    (VLAX-MAKE-VARIANT sa))
    )
    )
    )
    )
    )
    (DEFUN cadgirl:rotationmode (xref / objrotation)
    (IF rotation-mode
    (PROGN (SETQ objrotation (VLAX-GET-PROPERTY xref 'rotation))
    (IF (/= 0 (cadgirl:rtd objrotation))
    (VLAX-PUT-PROPERTY xref 'rotation 0)
    )
    )
    )
    )
    ;| main |;
    (VLA-STARTUNDOMARK (cadgirl:activedocument))
    (VLAX-FOR each (cadgirl:get-blocks) ;| |;
    (IF (= (VLA-GET-ISXREF each) :VLAX-TRUE) ;| |;
    (IF ;| if ssget is successful, xref is not nested |;
    (SETQ sset (SSGET "X" (LIST (CONS 0 "INSERT") (CONS 2 (VLA-GET-NAME
    each))))) ;| get selection set of xref |;
    (PROGN (SETQ sset-count (1- (SSLENGTH sset))) ;| -1 the length
    cause first index in sset is 0 |;
    (SETQ sset-index 0) ;| first in sset |;
    (WHILE (<= sset-index sset-count) ;| while index is <= count
    |;
    (PROGN ;| |;
    (SETQ entityname (SSNAME sset sset-index)) ;| entity
    name |;
    (SETQ xref-obj (VLAX-ENAME->VLA-OBJECT (SSNAME sset
    sset-index))) ;| convert to vla |;
    (SETQ xref-name (STRCASE (VLAX-GET-PROPERTY xref-obj
    'name))) ;| get name of xref |;
    (SETQ xref-layer (STRCASE (VLAX-GET-PROPERTY xref-obj
    'layer))) ;| get xrefs current layername |;
    (IF (/= xref-name xref-layer) ;| if xrefs name does not
    equal layername |;
    (PROGN ;(PRINC " xref name & layer name NOT equal
    \n\n")
    (princ)
    ;;; (cadgirl:layerthaw xref-layer) ;| thaw xrefs
    current layer |;
    ;;; (cadgirl:layeron xref-layer) ;| turn on xrefs
    current layer |;
    ;;; (cadgirl:layerunlock xref-layer) ;| unlock xrefs
    current layer |;
    ;;; (cadgirl:layeradd xref-name) ;| add new layer if
    needed |;
    ;;; (cadgirl:layerunlock xref-name) ;| make sure
    xrefs new layer is unlocked |;
    ;;; (VLAX-PUT-PROPERTY xref-obj 'layer xref-name) ;|
    put xref on its new named layer |;
    ;;; (cadgirl:insertionmode xref-obj) ;| check
    insertion point |;
    ;;; (cadgirl:rotationmode xref-obj) ;| check rotation
    |;
    ;;; (cadgirl:lockmode xref-name) ;| lock/unlock xrefs
    layer |;
    ) ;| end PROGN |;
    (PROGN ;(PRINC " xref name & layer name EQUAL
    \n\n")
    (cadgirl:layerthaw xref-layer) ;| thaw xrefs current
    layer |;
    (cadgirl:layeron xref-layer) ;| turn on xrefs
    current layer |;
    (cadgirl:layerunlock xref-layer) ;| unlock xrefs
    current layer |;
    (cadgirl:insertionmode xref-obj) ;| check insertion
    point |;
    (cadgirl:rotationmode xref-obj) ;| check rotation |;
    (cadgirl:lockmode xref-name) ;| lock/unlock xrefs
    layer |;
    ) ;| end PROGN |;
    ) ;| end IF |;
    ) ;| end PROGN |;
    (SETQ sset-index (1+ sset-index)) ;| increment index |;
    ) ;| end WHILE |;
    ) ;| end PROGN |;
    ;(PRINC (STRCAT (VLA-GET-NAME each) " is NESTED xref \n")) ;| if ssget is
    not successful, xref is nested |;
    );| end IF |;
    ) ;| end IF |;
    ) ;| end VLAX-FOR |;
    (VLA-ENDUNDOMARK (cadgirl:activedocument))
    (PRINC)
    ) ;| end DEFUN |;


    (DEFUN c:xr-layer ()
    (cadgirl:xreflir nil nil nil)
    )
    ;;;(PRINC "\n\n ' XR-LAYER ' xrefs to named layer")

    (DEFUN c:xr-rot ()
    (cadgirl:xreflir nil nil T)
    )
    ;;;(PRINC "\n\n ' XR-ROT ' xrefs to zero rotation")

    (DEFUN c:xr-ins-rot ()
    (cadgirl:xreflir nil T T)
    )
    ;;;(PRINC "\n\n ' XR-INS-ROT ' xrefs to 0,0,0 & zero rotation ")

    (DEFUN c:xr-lock-ins-rot ()
    (cadgirl:xreflir T T T)
    )
    ;;;(PRINC "\n\n ' XR-LOCK-INS-ROT ' xrefs to locked layer, 0,0,0, & zero
    rotation")

    (DEFUN c:xr-lock-ins ()
    (cadgirl:xreflir T T nil)
    )
    ;;;(PRINC "\n\n ' XR-LOCK-INS ' xrefs to locked layer & 0,0,0")

    (DEFUN c:xr-lock ()
    (cadgirl:xreflir T nil nil)
    )
    ;;;(PRINC "\n\n ' XR-LOCK ' xrefs to locked layer")

    (DEFUN c:xr-ins ()
    (cadgirl:xreflir nil T nil)
    )
    ;;;(PRINC "\n\n ' XR-INS ' xrefs to 0,0,0")

    (PRINC)

    ;|«Visual LISP© Format Options»
    (135 2 1 2 nil "end of " 100 9 2 1 nil nil T nil T)
    ;*** DO NOT add text below the comment! ***|;
     
    no.name, Jul 1, 2004
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.