VB dialog box to add layers

Discussion in 'AutoCAD' started by rerick, Aug 16, 2004.

  1. rerick

    rerick Guest

    I am creating a dialog box that will add layers the user picks from a list. Here are my issues:

    1: do I use a list box to list the names or check boxes?
    2: how do I check to see what layers are already in the drawing and grey them out in the dialog box?
    3: Once the layers have been selected by the user, how do I pass them to AutoCAD 2005 and create the layers?

    I am pretty new to VB and desperately need this to impress the big dogs. Please Help
     
    rerick, Aug 16, 2004
    #1
  2. rerick

    Ed Jobe Guest

    Do you have to do it via vba? Have you tried the Standards checker? Create a
    template with the layers you need and check the dwg against it.

    --
    ----
    Ed
    ----
    AutoCAD 2005 and create the layers?
    Please Help
     
    Ed Jobe, Aug 16, 2004
    #2
  3. rerick

    rerick Guest

    Thanks for the suggestion. However, the powers that be have decided they want dialog boxes. Since they sign the pay checks they get what they want. And they want pretty little dialog boxes.
     
    rerick, Aug 16, 2004
    #3
  4. In this case, Ed is right. 'Big dogs' are more impressed by saving $. The
    amount of time for you to write this vs. the time to implement a standard
    feature is far less - noot to mention the standards then provides a means
    to continually check the work done by others to ensure they are following
    policy. Remember the first rule of programming - the best program s one you
    don't have to write!

    If you still choose to follow the path you're on, just look in the help
    files. AutoCAD's has a couple of code examples for finding and creating
    layers; MS VBA has a tutorial on forms as well as dealing with controls.
    All of the examples can be pulled together in rather short time. Here are a
    couple hints to keep you on the right path:

    1. Use a list box with selection set to extended multiple - NO checkboxes
    2. On the form load event, read each layer from the drawing then check to
    see if it is in the listbox - somethng like:

    Dim oLyr As AcadLlayer

    For Each oLyr In ThisDrawing.Layers
    .....
    Next

    You also will not be able to grey-out items within the listbox. What you'll
    need to do is have two listboxes ~ 1 for stds; 1 for already in drawing.

    3. look in the AutoCAD help file for the example - its a copy/paste!


    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 17, 2004
    #4
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.