MLineStyle generation via VBA

Discussion in 'AutoCAD' started by Maksim Sestic, Jan 11, 2004.

  1. Dear all,

    Here's a repeated question with a Lisp hint: how to programmaticaly create a
    MLineStyle using VBA? I'm not familiar with the ACAD's Dictionary collection
    and it's XRecord objects, and wasn't able to find a proper explanation of
    how to use it - neither in NG nor in help documentation. I'd really
    appreciate it anybody gives a short explanation of how to convert given Lisp
    code to VBA.

    Lisp code below (many thanks to D. Kozina for the tip):

    ;; STD-ENTMAKE-MLINESTYLE Usage Example:
    ;; (setq elist
    ;; '((2 . "MYSTYLE")
    ;; (3 . "My MLinestyle")
    ;; (62 . 0)
    ;; (70 . 0)
    ;; (71 . 3)
    ;; (49 . -5.0)
    ;; (62 . 256)
    ;; (6 . "BYLAYER")
    ;; (49 . 0.0)
    ;; (62 . 152) ;; color
    ;; (6 . "ABE05") ;; ??
    ;; (49 . 5.0)
    ;; (62 . 256)
    ;; (6 . "BYLAYER")))
    ;; (STD-ENTMAKE-MLINESTYLE elist)
    (defun STD-ENTMAKE-MLINESTYLE (elist / opts)
    (std-require "DICT")
    (setq opts (list
    '(0 . "MLINESTYLE")
    '(102 . "{ACAD_REACTORS")
    (cons 330 (dict-entity "ACAD_MLINESTYLE"))
    '(102 . "}")
    '(100 . "AcDbMlineStyle")
    '(70 . 0)
    ;; End Cap Flag Values: 0 - No caps; 16 - Cap first end
    ;; 256 - Cap last end; 272 - Cap each end;
    ;; See also AutoCAD Customization Guide, Appendix C -
    ;; "ACAD_MLINESTYLE Group Codes" Table for other values
    ;;'(62 . 0) ; Fill Color, if flag 70 has 1 set
    (cons 51 (/ PI 2)) ; Start Angle
    (cons 52 (/ PI 2)))) ; End Angle
    (dictadd (dict-entity "ACAD_MLINESTYLE")
    (std-getval 2 elist)
    (std-%entmake-template elist opts '(2 3 71 49 62 6) T)))

    ------------------End of Lisp example--------------------------
    Regards,
    Maksim Sestic
     
    Maksim Sestic, Jan 11, 2004
    #1
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.