+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2011
    Posts
    95

    Unhappy Turn on/off Xref layers

    Registered forum members do not see this ad.

    Using Lee's ObjectDBX. How can I turn on/off layers on the xref? If it is possible... I need to turn on/off layers on our electrical plot sheets which is around 100 drawings. We use model space for our plot sheet and everything is xref in.

  2. #2
    Forum Deity BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    256GB SSD
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Using
    Civil 3D 2015
    Join Date
    Nov 2009
    Posts
    4,672

    Default

    Code:
    (vl-load-com)
    ...
    ;;<-- Open dbxDoc
    (vlax-for oLayer (vla-get-layers dbxDoc)
      (if (vl-string-search "|" (vla-get-name oLayer))
        (vl-put-layeron oLayer :vlax-true)) ;<-- Change to :vlax-false to turn off
    )
    ...
    [edit] I just re-read your post, and saw you inquired about on/off, and not freeze/thaw. Code corrected [/edit]
    "Potential has a shelf life." - Margaret Atwood

    Autodesk Exchange Apps
    ~ Autoloader ~ AutoCAD Security

  3. #3
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,143

    Default

    I'm not sure of his construct, but I'm sure he gives you the document to work with, so you could use an example like the following:

    Code:
    ((lambda (doc)
       (vlax-for layer (vla-get-layers doc)
         (if (wcmatch (vla-get-name layer) "*|*")
           (vla-put-layeron layer :vlax-false)
         )
       )
     )
      (vla-get-activedocument (vlax-get-acad-object))
    )
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,143

    Default

    Oops, didn't realize I was late to the ball.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,811

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by alanjt View Post
    I'm not sure of his construct, but I'm sure he gives you the document to work with ...
    Absolutely right

    @ LISP2LEARN Supply the ODBX subfunction with the lambda function from Alan's example and it should work.

    For reference, here is the code being referred to:

    http://lee-mac.com/odbxbase.html
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Turn off layers on a drawing...
    By shakuhachi in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 8th May 2011, 09:34 pm
  2. Turn ALL layers on/off at once?
    By rochblue in forum AutoCAD Drawing Management & Output
    Replies: 11
    Last Post: 28th Aug 2009, 01:49 pm
  3. Turn off layers in more than one drawing?
    By Siberian in forum AutoCAD General
    Replies: 7
    Last Post: 30th Jul 2009, 10:26 am
  4. VBA turn on/off certain layers
    By tinus94 in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 4th Mar 2009, 02:45 pm
  5. Replies: 3
    Last Post: 8th Nov 2005, 07:03 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts