TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on April 13, 2014, 11:53:16 AM
-
In this part of code,
- How to create this text as annotative?
- String did not converted to capital.
(entmakex (list '(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 40 250)
'(8 . "S-BEAM-TEXT")
'(7 . "SDC-TEXT") ;Text style
'(10 0.0 0.0 0.0) ;The base insert point of the text (ignored when not left aligned)
(cons 11 (polar pt (+ (/ pi 2) ang) ds)) ;The insert point of the text when not left aligned
(cons 1 "Bx") ;String
(cons 50 ang) ;Rotate the text to follow the line/pline
(cons 72 D72) ; Horizontal text justification type 1= Center
(cons 73 D73)
))
(command "DDEDIT" "L" "")
(setq entity (entlast))
(setq dxfdata (entget entity))
(setq old-dxf (cdr (assoc 1 dxfdata)))
(setq new-dxf (cons 1 (strcase old-dxf)))
(setq dxfdata (subst new-dxf old-dxf dxfdata))
(entmod dxfdata)
-
You can use CHPROP to make the text annotative.
BTW: http://help.autodesk.com/cloudhelp/2015/ENU/AutoCAD-Core/files/GUID-BC8246C2-37B7-47D2-B480-1955D93D9569.htm
[edit]
An object that is annotative will contain the "AcadAnnotative" xdata.
WARNING: If it is changed back to non-annotative, the xdata remains but one of the values changes from 1 to 0.
[/edit]
-
Thanks Mark
(initget "Yes No") ; Ask if text Annotative OR not
(setq *anno (cond ((getkword (strcat "\nText Annotatione [Yes/No] <" (setq *anos (cond ( *anos ) ( "Yes" ))) ">? "))) ( *anno )))
(if (= *anno "Yes")
(command "CHPROP" "L" "" "Annotative" "Yes" "") ; Text Annotative
)
Is there any solution for capslock?
-
FYI: If you create a text object with VL, and the active textstyle is annotative, it will be annotative.
-
FYI: If you create a text object with VL, and the active textstyle is annotative, it will be annotative.
OK but
- If TStyle not exist I'll create but not anno
- If exist and not annotative
This subroutine what i am using
;; Create TStyle
(defun _makefonts (listoffonts / doc font fntdir st)
(vl-load-com)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
fntdir (strcat (getenv "windir") "\\Fonts\\")
)
(foreach f listoffonts
(cond ((or (setq font (findfile (cdr f)))
(and (setq font (findfile (strcat fntdir (cdr f)))) (findfile font))
)
(setq st (vla-add (vla-get-textstyles doc) (car f)))
(vlax-put-property st 'fontfile font)
(vlax-put-property st 'width 0.8)
(vlax-put-property st 'height 0.)))) (princ))
-
Do you guys need a wrapper for adding Annotation Scales and making objects annotative for AutoLisp?
-
Is it easy to convert this text to be annotative?
I borrowed this from lee-mac I beleive.
(entmake
(list
(cons 0 "ENDBLK")
(cons 8 "0")
)
)
(
(lambda ( lst )
(regapp "ACAD")
(regapp "AcadAnnotative")
(entmod
(append (subst (cons 70 1) (assoc 70 lst) lst)
(list
(list -3
(list "ACAD"
(cons 1000 "DesignCenter Data")
(cons 1002 "{")
(cons 1070 1)
(cons 1070 1)
(cons 1002 "}")
)
(list "AcadAnnotative"
(cons 1000 "AnnotativeData")
(cons 1002 "{")
(cons 1070 1)
(cons 1070 1)
(cons 1002 "}")
)
)
)
)
)
)
(entget (cdr (assoc 330 (entget (tblobjname "BLOCK" partnumber)))))
)
(vl-load-com)
(setq BLOCKS
(vla-get-Blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
BLK (vla-Item BLOCKS partnumber)
)
(vla-put-explodable (vla-Item BLOCKS partnumber) :vlax-false)
This makes the text of my block annotative and non-explodable