0 Members and 1 Guest are viewing this topic.
;; gc:GetDictEntries;; Returns the dictionary entries as a list of dotted pairs: (entryName . entryename);;;; Argument : dict the dictionary (ENAME or DXF list)(defun gc:GetDictEntries (dict / result) (and (= (type dict) 'ENAME) (setq dict (entget dict))) (while (setq dict (vl-member-if (function (lambda (x) (= (car x) 3))) (cdr dict))) (setq result (cons (cons (cdar dict) (cdadr dict)) result)) ) (reverse result))
;;-------------------=={ Add MLine Style }==------------------;;;; ;;;; Adds an MLine Style to the ACAD_MLINESTYLE dictionary ;;;;------------------------------------------------------------;;;; Author: Lee McDonnell, 2010 ;;;; ;;;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;;;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;;;;------------------------------------------------------------;;;; Arguments: ;;;; data - a DXF list of MLineStyle data ;;;;------------------------------------------------------------;;;; Returns: MLineStyle Dictionary Entity, else nil ;;;;------------------------------------------------------------;;(defun LM:AddMLineStyle ( data / dic obj ) ;; © Lee Mac 2010 (if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE")) (not (dictsearch (setq dic (cdr (assoc -1 dic))) (cdr (assoc 2 data)))) (setq obj (entmakex data))) (dictadd dic (cdr (assoc 2 data)) obj) ));;-----------------=={ Delete MLine Style }==-----------------;;;; ;;;; Removes an MLine Style from the ACAD_MLINESTYLE ;;;; dictionary ;;;;------------------------------------------------------------;;;; Author: Lee McDonnell, 2010 ;;;; ;;;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;;;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;;;;------------------------------------------------------------;;;; Arguments: ;;;; name - the name of an MLine Style to remove ;;;;------------------------------------------------------------;;;; Returns: Entity name of removed style, else nil ;;;;------------------------------------------------------------;;(defun LM:DeleteMLineStyle ( name / dic ) ;; © Lee Mac 2010 (if (setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE")) (dictremove (cdr (assoc -1 dic)) name) ));;------------------------------------------------------------;;;; Test Function(defun Example ( / lst ) (setq lst (list (cons 0 "MLINESTYLE") (cons 100 "AcDbMlineStyle") (cons 2 "Example") ; Name (cons 70 (+ 272)) ; caps/fill/joints (cons 3 "") ; Desc (cons 51 (/ pi 2.)); Start ang (cons 52 (/ pi 2.)); End ang (cons 71 2) ; Number of lines (cons 49 -0.5) ; Element Offset (cons 62 256) ; Element Colour (cons 6 "BYLAYER") ; Element Linetype (cons 49 0.5) (cons 62 256) (cons 6 "BYLAYER") ) ) (LM:AddMLineStyle lst))