- (defun get-or-make-Xrecord (/ anXrec)
- ;Defines mainDict
- (Setq mainDict (namedobjdict))
- ;Defines Entity LineOne
- ;Not Sure How To Do This Assuming Handent DictSearch and NentSel
- (Setq LineOne (...))
- ;Defines Entity LineTwo
- ;Not Sure How To Do This Assuming Handent DictSearch and NentSel
- (Setq LineTwo (...))
- ;Defines LongestLine
- (Setq longLine ((max ("LineOne" "LineTwo"))))
- (setq mainDict (namedobjdict))
- (cond
-
- ;;if "OUR_DICT" is now valid then look for "OUR_VARS" Xrecord
- ((not (setq anXrec (dictsearch maindict "OUR_VARS")))
-
- ;;if "OUR_VARS" was not found then create it
- ;;NOT SURE HOW TO APPLY TEXT CHARACTERS
- (setq anXrec (entmakex '((0 . "XRECORD")
- (100 . "AcDbXrecord")
- (7 . "Arial")
- (8 . "A09--T-")
- (40 . 2.0)
- (? . ?))
- )
- )
-
- ;;if creation succeeded then add it to our dictionary
- (if anXrec (setq anXrec (dictadd maindict "OUR_VARS" anXrec)))
- )
-
- ;;if it's already present then just return its entity name
- (setq anXrec
-
- (cdr (assoc -1 (dictsearch maindict "OUR_VARS")))
- )
- )
- )
- ;(defun c:subent ()
- (while
- (setq Ent (entsel "\nPick an entity: "))
- (print (strcat "Entity handle is: "
- (cdr (assoc 5 (entget (car Ent))))))
- )
- (while
- (setq Ent (nentsel "\nPick an entity or subEntity: "))
- (print (strcat "Entity or subEntity handle is: "
- (cdr (assoc 5 (entget (car Ent))))))
- )
- (prompt "\nDone.")
- (princ)
- )
- ;Returns Entity handle
- ;(handent "XXX") Returns entity name based on handle
我算出了sslength/getlength来确定lineone/linetwo。仍然不确定如何将这些信息作为实体变量输入到新创建的xrecord中...
我也不确定Max函数是否评估类...
非常感谢任何指示、参考资料或帮助 |