Glen Smith Posted October 21, 2010 Share Posted October 21, 2010 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 Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 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 Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted October 21, 2010 Author Share Posted October 21, 2010 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? Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 Just use CHANGE, as I displayed above. If it's annotative, it will change it to non-annotative and leave the size as is. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2010 Share Posted October 21, 2010 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) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 That'll work. I sometimes use CHANGE to turn non-annotative text (taken from old drawings) into annotative text. Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted October 21, 2010 Author Share Posted October 21, 2010 I tried using the change command, results as follows original on left changed on right: Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 21, 2010 Share Posted October 21, 2010 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 Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted October 21, 2010 Author Share Posted October 21, 2010 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. Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 ?? (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) ) Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted October 21, 2010 Author Share Posted October 21, 2010 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. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 12, 2016 Share Posted August 12, 2016 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 12, 2016 Share Posted August 12, 2016 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. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 15, 2016 Share Posted August 15, 2016 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? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 15, 2016 Share Posted August 15, 2016 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). Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted August 15, 2016 Share Posted August 15, 2016 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. Quote Link to comment Share on other sites More sharing options...
Bluebird1973 Posted August 16, 2016 Share Posted August 16, 2016 Thank you Lee Mac and Roy_043 for the explanation ... I see that I still have to learn a lot ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.