Loading a linetype

Discussion in 'AutoCAD' started by Marcel Goulet, Sep 10, 2004.

  1. Hi,

    How can I load a linetype in the active document using VLisp.
    For example, Hidden.

    Thanks
     
    Marcel Goulet, Sep 10, 2004
    #1
  2. Marcel Goulet

    BillZ Guest

    (setq *acad* (vlax-get-acad-object)
    *acad_doc* (vla-get-activedocument *acad*)
    *acad_lin* (vla-get-linetypes *acad_doc*)
    )

    (vla-add *acad_lin* "hidden")


    Bill
     
    BillZ, Sep 10, 2004
    #2
  3. Marcel Goulet

    Jeff Mishler Guest

    Bill,
    From the help file (R2002) this won't work as expected.....

    Although you can create a linetype and add it to the Linetypes Collection
    object using this method, it will be created with the default properties
    only. Because you cannot edit properties of the Linetype object with this
    release of ActiveX Automation, use the Load method to load existing
    linetypes into your drawing.

    Now, if this has changed in the newer releases, then forget I said
    anything.... ;-)
     
    Jeff Mishler, Sep 10, 2004
    #3
  4. Marcel Goulet

    Doug Broad Guest

    Use the load method of the linetypes collection.
     
    Doug Broad, Sep 10, 2004
    #4
  5. Marcel Goulet

    BillZ Guest

    Dang,
    Just when I think I know something....

    But still the defaults may be just fine. :)

    Bill
     
    BillZ, Sep 10, 2004
    #5
  6. Marcel Goulet

    Jeff Mishler Guest

    The "default" is "continuous" which kinda defeats the purpose of a linetype
    named "hidden"...... ;-)

    So just changing the last line of code you provided to this will work, if it
    exists in the file.
    (vla-load *acad_lin* "hidden" "acad.lin")
     
    Jeff Mishler, Sep 10, 2004
    #6
  7. Marcel Goulet

    BillZ Guest

    Must've changed for 2005.

    Command: (vla-load *acad_lin* "hidden" "acad.lin")
    ; error: Automation Error. Duplicate record name

    Command: (vla-load *acad_lin* "hidden")

    Works fine and the line is "dashed" by default.

    Bill
     
    BillZ, Sep 10, 2004
    #7
  8. Marcel Goulet

    BillZ Guest

    Opps,
    I meant to say:

    (vla-add *acad_lin* "hidden")

    Works fine and the line is "dashed" by default.

    Bill
     
    BillZ, Sep 10, 2004
    #8
  9. Marcel Goulet

    Jeff Mishler Guest

    Must've changed for 2005.
    The first line's error means that the linetype is already loaded in the
    drawing, which means the second line (I know you meant add, not load)
    doesn't error and is "hidden by default" because it is already
    defined........

    Make sure to purge the hidden linetype first, then try again ;-)
     
    Jeff Mishler, Sep 10, 2004
    #9
  10. Marcel Goulet

    BillZ Guest

    Jeff,

    Point taken.

    Thanks for the lesson. :)


    Bill
     
    BillZ, Sep 10, 2004
    #10
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.