Author Topic: How to convert Text To annotative  (Read 2541 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1421
How to convert Text To annotative
« 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.
Code: [Select]
(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)

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to convert Text To annotative
« Reply #1 on: April 13, 2014, 04:15:32 PM »
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]
« Last Edit: April 13, 2014, 04:37:28 PM by Crank »
Vault Professional 2023     +     AEC Collection

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: How to convert Text To annotative
« Reply #2 on: April 14, 2014, 03:30:00 AM »
Thanks Mark
Code: [Select]
(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?

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: How to convert Text To annotative
« Reply #3 on: April 14, 2014, 02:22:52 PM »
FYI: If you create a text object with VL, and the active textstyle is annotative, it will be annotative.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: How to convert Text To annotative
« Reply #4 on: April 15, 2014, 05:29:36 AM »
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
Code: [Select]
;;   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))


Jeff H

  • Needs a day job
  • Posts: 6150
Re: How to convert Text To annotative
« Reply #5 on: April 15, 2014, 06:29:25 AM »
Do you guys need a wrapper for adding Annotation Scales and making objects annotative for AutoLisp?




ChrisCarlson

  • Guest
Re: How to convert Text To annotative
« Reply #6 on: April 15, 2014, 07:56:21 AM »
Is it easy to convert this text to be annotative?

I borrowed this from lee-mac I beleive.

Code: [Select]
(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