Jump to content

Annotative text conversion


Glen Smith

Recommended Posts

Does anyone have a LISP that will help change annotative text to non annotative text? I can just do a quick select and change the style, but I'd like to be able to set the text height of each bit of text based on the "Model Text Height" value of the annotative text.

 

Our office has purchased some licenses of AutoCAD FreeStyle which allows our technicians to create field inspections and site surveys and at least get a first draft into CAD rather than scribbled on wadded up bar napkins. This is good.

 

FreeStyle has some issues and limitations that I have to deal with once I get these drawings though. I have not messed with FreeStyle to see if there is a way to handle the issues at that end. The drawings that I'm getting have had Text put into them, but FreeStyle appears to use Annotative text to size things. So once drawings get finally printed out, they are rarely at the right scale for the annotative features to work.

 

Glen

PS EDIT:

For now I'm dealing with it by slapping the titleblock into model space, scaling it and plotting to fit from Mspace, but I'm not satisfied with that. (uploaded example)

freestyle anno txt.dwg

Link to comment
Share on other sites

Seems like you are defeating the purpose of annotative text.

 

Command: CHANGE

Select objects: Specify opposite corner: 2 found

Select objects:
Specify change point or [Properties]: P

Enter property to change 
[Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: A

Make Annotative? [Yes/No] <Yes>:

Enter property to change 

Link to comment
Share on other sites

Yes, that is exactly what I want to do - kill the annotative text. For better or for worse, we are not using annotative text in our main drawings. However, simply changing it to non annotative screws with the size. I have noticed that among the properties that Annotative text has is the size to display in Model Space and Paper space. What I want to do is step through all the annotative text, query what size it is set to display in Model space, set it to non annotative and set the text height to that size.

 

Is there a LISP command that will echo back all the properties of a selection of MText?

Link to comment
Share on other sites

Never done it myself, but using Alan's pointers...

 

(defun c:test ( / ss )
 (if (setq ss (ssget "_X" '((0 . "TEXT,MTEXT"))))
   (command "_.change" ss "" "_P" "_A" "_No" "")
 )
 (princ)
)

Link to comment
Share on other sites

A gotcha with the change command:

 

Except for zero-thickness lines, the objects selected must be parallel to the current user coordinate system (UCS).

 

From A2K Help

 

-David

Link to comment
Share on other sites

I had hopes that it was that simple, but just visible in the lower left quadrent of the 'good' version above is the ucs icon. With the text parallel to it. :(

Link to comment
Share on other sites

??

(defun c:Test (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "MTEXT,TEXT"))))
   ((lambda (i / e)
      (while (setq e (ssname ss (setq i (1+ i))))
        (if (entmakex (vl-remove-if
                        (function (lambda (x) (vl-position (car x) '(-1 102 330 360))))
                        (entget e)
                      )
            )
          (entdel e)
        )
      )
    )
     -1
   )
 )
 (princ)
)

Link to comment
Share on other sites

And We HAVE A WINNER!!!!

 

I think. I need to look at it a bit more, but it appears that it works. I've never been so happy to see a drawing not make any visible changes.

 

Many Thanks.

Link to comment
Share on other sites

  • 5 years later...

Hi alanjt,

 

could you please add some comments to your code?

 

I didn't understand:

 (function (lambda (x) (vl-position (car x) '(-1 102 330 360)))) 

 

??

(defun c:Test (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "MTEXT,TEXT"))))
   ((lambda (i / e)
      (while (setq e (ssname ss (setq i (1+ i))))
        (if (entmakex (vl-remove-if
                        (function (lambda (x) (vl-position (car x) '(-1 102 330 360))))
                        (entget e)
                      )
            )
          (entdel e)
        )
      )
    )
     -1
   )
 )
 (princ)
)

 

thx

Bluebird

Link to comment
Share on other sites

The lambda function is evaluated with every item in the list supplied to vl-remove-if (in this case, the DXF data); the lambda function parameter 'x' represents an item in the list. The vl-remove-if expression is therefore removing dotted pairs from the supplied DXF data for which the first element of the dotted pair is equal to either -1, 102, 330, or 360.

Link to comment
Share on other sites

Thank you Lee!!

 

... now I understand a little bit more ...

 

The lambda function is evaluated with every item in the list supplied to vl-remove-if (in this case, the DXF data); the lambda function parameter 'x' represents an item in the list. The vl-remove-if expression is therefore removing dotted pairs from the supplied DXF data for which the first element of the dotted pair is equal to either -1, 102, 330, or 360.

 

... but if I check e.g. a MText with annotation:

 

(-1 . )

(0 . "MTEXT")

(5 . "D3BE")

(102 . "{ACAD_XDICTIONARY")

(360 . )

(102 . "}")

(330 . )

(100 . "AcDbEntity")

(67 . 0)

(410 . "Model")

(8 . "_FFS Pos.Nr")

(100 . "AcDbMText")

(10 27000.0 -2750.0 0.0)

(40 . 250.0)

(41 . 1722.79)

(46 . 0.0)

(71 . 1)

(72 . 5)

(1 . "Coffee Bar")

(7 . "Arial")

(210 0.0 0.0 1.0)

(11 1.0 0.0 0.0)

(42 . 1656.89)

(43 . 258.527)

(50 . 0.0)

(73 . 1)

(44 . 1.0)

 

 

and MTEXT without annotation

 

(-1 . )

(0 . "MTEXT")

(330 . )

(5 . "356CD")

(100 . "AcDbEntity")

(67 . 0)

(410 . "Model")

(8 . "_FFS Pos.Nr")

(100 . "AcDbMText")

(10 27000.0 -2750.0 0.0)

(40 . 250.0)

(41 . 1722.79)

(46 . 0.0)

(71 . 1)

(72 . 5)

(1 . "Coffee Bar")

(7 . "Arial")

(210 0.0 0.0 1.0)

(11 1.0 0.0 0.0)

(42 . 1656.89)

(43 . 258.527)

(50 . 0.0)

(73 . 1)

(44 . 1.0)

 

there is still DXF Code " -1 " and " 330 " ???

 

Why do you remove it and it is still there ??

What did I miss?

Link to comment
Share on other sites

DXF groups -1 & 330 refer to the entity itself and the parent entity respectively, therefore, these groups will always be present in the DXF data.

 

Note that the DXF groups are being removed from the DXF data list supplied to the entmakex function, which generates a new entity from the DXF data (which will of course contain DXF groups -1 & 330). It is not absolutely necessary to remove these groups from the list supplied to entmakex (as they will be ignored).

Link to comment
Share on other sites

First it is important to realise the code creates modified copies of entities. The original entities are deleted. This is why the group code -1 items in the entity lists (the enames) are different. And, you may not know this, it is possible to create an entity using a partial entity list. That is what is happening here. The argument for entmakex is a partial list (without group code -1, 102, 330 and 360*), but the new entity will automatically have group codes -1 and 330 (ename of the model or paper space block) in its entity list.

 

* Although the code will also work if only gc 360 is removed, IMO it is strange that gc 5 is not removed as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...