+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Forum Newbie
    Discipline
    Mechanical
    Using
    AutoCAD 2016
    Join Date
    Dec 2017
    Posts
    4

    Default Autocad layer automation through external applicaiton - need guidances

    Registered forum members do not see this ad.

    Hi,

    I have a requirement in layer management.
    There are many layers in a drawing.
    I need to give some layers as input through some application like excel or anything else.
    As a result the drawing should be opened with the input layers to be visible and remaining layer in off state or hidden.

  2. #2
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    The easiest way is to open the dwg and set the layers a small delay. You can also set the open which dwg if required. There are a couple of different ways to set the layers use "layer states" or read a text file with the layer settings. You can modify a dwg before opening but that is a bit more difficult.

    If using excel it can write all the code required as a script file.

    Else more info is required and a lisp can be provided, there a lot of this type of request.

    need to know more about the layers in the dwg as an example
    -layer s 0 off * n on w*
    A man who never made mistakes never made anything

  3. #3
    Senior Member
    Discipline
    Civil
    Aftertouch's Discipline Details
    Discipline
    Civil
    Details
    Engineer
    Using
    AutoCAD 2017
    Join Date
    Jul 2016
    Location
    Netherlands
    Posts
    302

    Default

    You could use a ReadExcel function,
    Or a 'simple' list with the layers, and process that with a foreach function.
    Very simple example, no error catching or anytin'

    Code:
    (defun C:CADTUTUOR ( / )
    (setvar "CLAYER" "0")
    (setvar "Expert" 1)
    (command "-layer" "OFF" "*" "")
    (setq offlayerslist (list "Layer1" "Layer2"))
    (foreach x offlayerslist
    	(command "-layer" "ON" x "")
    )
    (princ)
    )

  4. #4
    Forum Newbie
    Discipline
    Mechanical
    Using
    AutoCAD 2016
    Join Date
    Dec 2017
    Posts
    4

    Default

    Consider the drawing contains 30 layers.
    I need to open the drawing with a prompt that which are the layers should be shown?
    I will select 10 layers and others 20 will be hidden.
    Each time, I should not write a program or layers name.
    I need to select the layers through a checkbox or some other means.
    And these combinations will repeatedly change.

  5. #5
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2012
    Posts
    338

    Default

    arunkumarunicorn
    Use this :
    Attached Images

  6. #6
    Forum Newbie
    Discipline
    Mechanical
    Using
    AutoCAD 2016
    Join Date
    Dec 2017
    Posts
    4

    Default



    Hi,
    I select the layers ( options & spec in excel ).
    Each spec is a layer in drawing.
    After selecting the layer from the excel,
    a process should initiate from excel to open the autocad drawing.
    The drawing should open with the checked layers from the excel as visible.

  7. #7
    Forum Newbie
    Discipline
    Mechanical
    Using
    AutoCAD 2016
    Join Date
    Dec 2017
    Posts
    4

    Default Is it possible ?

    Registered forum members do not see this ad.

    Hi,
    I select the layers ( options & spec in excel ).
    Each spec is a layer in drawing.
    After selecting the layer from the excel,
    a process should initiate from excel to open the autocad drawing.
    The drawing should open with the checked layers from the excel as visible.
    Attached Images

Similar Threads

  1. Autocad is unable to service automation request
    By Perifanos in forum .NET, ObjectARX & VBA
    Replies: 2
    Last Post: 16th Mar 2013, 10:09 pm
  2. Can we open AutoCAD LT 2005 and 2007 via OLE automation
    By sun in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 27th Oct 2008, 10:18 pm
  3. VB Automation - How to write text in superscript to AutoCAD ?
    By chill in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 6th Apr 2008, 08:30 am
  4. select by layer automation
    By ChrisCMU in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 6th Feb 2008, 07:57 pm
  5. AutoCAD + COM Automation
    By askrius in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 21st Nov 2007, 01:40 am

Tags for this Thread

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