Author Topic: Entmake Text misplaces the text.  (Read 5554 times)

0 Members and 1 Guest are viewing this topic.

tcebob

  • Guest
Entmake Text misplaces the text.
« on: May 07, 2005, 10:26:35 AM »
Here's a snippet:

Code: [Select]

(setq elist
  (list
    '(0 . "TEXT")
    (cons 8 (getvar "clayer"))
    (cons 7 (getvar "textstyle"))
    (cons 40 (getvar "textsize"))
    (cons 50 (- [color=blue]tang[/color] 1.5708))    ;rotation
    (cons 10 [color=blue]pt2[/color]) ;insert point
    (cons 72 1)    ;justify center
    (cons 1 (strcat "L=" (rtos [color=blue]alen[/color] 2 2)))
  ) ;list
) ;setq
(entmake elist)


Everything SEEMS to work. Elist looks fine, with the insert point coordinates correct. After entmake the new object is near (0 0). And a peek at the new elist shows that my cons 10 got changed.

Here's the elist:
((0 . "TEXT") (8 . "P_Drain Text") (7 . "L") (40 . 20.0) (50 . 2.09701) (10 -485.495 -567.637 0.0) (72 . 1) (1 . "L=4659.65"))

And the resulting entlist:
((-1 . <Entity name: 7edca980>) (0 . TEXT)
(330 . <Entity name: 7efb4c10>) (5 . 512300) (100 .AcDbEntity) (67 . 0) (410 . Model) (8 . P_Drain Text) (100 . AcDbText) (10 39.942 -68.7653 0.0) (40 . 20.0)
(1 . L=4659.65) (50 . 2.09701) (41 . 1.0) (51 . 0.0) (7 . L) (71 . 0) (72 . 1) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0)
(100 . AcDbText) (73 . 0))

Where did I go wrong?

tcebob

SMadsen

  • Guest
Entmake Text misplaces the text.
« Reply #1 on: May 07, 2005, 10:38:38 AM »
When using justifications other than 71 = 0 or 73 = 0, the insertion point will be calculated from the code 11 point.
Try add (cons 11 pt2) to the list without changing anything else in it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Entmake Text misplaces the text.
« Reply #2 on: May 07, 2005, 11:17:15 AM »
Welcome to the Swamp...

I think Stig hit the nail on the head, so to speak.  [ He never misses ] :)
I ran the MakeEntmake.lsp on a center justified text string with 0,0,0 as the
center point and this is what I got.
Code: [Select]
;; Revision :05/07/2005 @11:05
(defun c:eMake ()
  (entmake '((0 . "TEXT")
             (100 . "AcDbEntity")
             (67 . 0)
             (8 . "F1_FIREPLACES")
             (100 . "AcDbText")
             (10 -21.0 0.0 0.0)
             (40 . 5.0)
             (1 . "L=4659.65")
             (50 . 0.0)
             (41 . 1.0)
             (51 . 0.0)
             (7 . "A4")
             (71 . 0)
             (72 . 1)
             (11 0.0 0.0 0.0)
             (100 . "AcDbText")
             (73 . 0)
            )
  )
  (princ)
) ; end eMaker


PS I formatted the code for posting.

Here is a post of interest.
http://www.theswamp.org/phpBB2/viewtopic.php?t=4814&highlight=makeentmake
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

tcebob

  • Guest
Entmake Text misplaces the text.
« Reply #3 on: May 07, 2005, 01:06:38 PM »
Ah. Code 11. I will put it to the test.

I thought I did format mine; it looked good on the preview. Or do you think the bb formatting overrides the code formatting?

Thanks,

tcebob

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Entmake Text misplaces the text.
« Reply #4 on: May 07, 2005, 02:01:02 PM »
Hello tcebob, welcome to theswamp.

Couple tips:

(1) Stig is scary smart (like a lisp savant), there are pearls of wisdom to be found in all his posts; seek them out!

(2) Alan (CAB) is one of the brightest, most prolific and friendly coder / swamp ambassaders we have. I don't know how he pounds out so much code but look around, he posts volumes of most excellent utilites and help posts, bar none!

(3) When posting code between [ code ] [ /code ] pairs I believe it just ignores any additional bb formatting, so it ends up messing with the actual posted logic.

(4) Info.fas (use your logon name and password when prompted) is a little utility I wrote that will spew the activex properties / methods and dxf data for any valid supplied or selected object / entity.

One use is that it can help you identify what info you need to (ent)make an entity, by displaying the data for an existing entity of the type you want to make.

For example, if I select a text entity it might show this info:

Code: [Select]
; IAcadText2: AutoCAD Text Interface
; Property values:
;   Alignment = 10
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00c2db8c>
;   Backward = 0
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0ce20f24>
;   Handle (RO) = "97"
;   HasExtensionDictionary (RO) = 0
;   Height = 0.09375
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0ced99e4>
;   InsertionPoint = (-0.8125 -0.046875 0.0)
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130054904
;   ObjectName (RO) = "AcDbText"
;   ObliqueAngle = 0.0
;   OwnerID (RO) = 2130054392
;   PlotStyleName = "ByLayer"
;   Rotation = 0.0
;   ScaleFactor = 1.0
;   StyleName = "Standard"
;   TextAlignmentPoint = (0.0 0.0 0.0)
;   TextGenerationFlag = 0
;   TextString = "TheSwamp.org rocks."
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0ceda9d0>
;   UpsideDown = 0
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   FieldCode ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()
; DXF Group Codes:
;   (-1 . <Entity name: 7ef60ef8>)
;   (0 . "TEXT")
;   (330 . <Entity name: 7ef60cf8>)
;   (5 . "97")
;   (100 . "AcDbEntity")
;   (67 . 0)
;   (410 . "Model")
;   (8 . "0")
;   (100 . "AcDbText")
;   (10 -0.8125 -0.046875 0.0)
;   (40 . 0.09375)
;   (1 . "TheSwamp.org rocks.")
;   (50 . 0.0)
;   (41 . 1.0)
;   (51 . 0.0)
;   (7 . "Standard")
;   (71 . 0)
;   (72 . 1)
;   (11 0.0 0.0 0.0)
;   (210 0.0 0.0 1.0)
;   (100 . "AcDbText")
;   (73 . 2)

As you can see, all it does is make a call to vlax-dump-object and entget respectively, formating the dxf data like vlax-dump-object does. I found it very convenient to have the two together.

Anyway, once you load the Info.fas utility you can use it at the command line via Info or nInfo, the latter being for nested entities (like inside a block or xref) or, if you have a saved entity name, object or handle, like this (info x), where x is a valid ename, object or handle.

Have fun.

:cheesy:

PS: I compiled info.fas using 2006, let me know if there are problems loading it in older AutoCAD versions; I can't test that scenario here because I only have 2006 on this machine. Thanks.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tcebob

  • Guest
Entmake Text misplaces the text.
« Reply #5 on: May 07, 2005, 04:30:50 PM »
Michael, I shall do as you suggest and download Info.fas. I sorta figured that Stig and Alan are good folks to listen to. If I have problems with Info.fas on my 2004 I will let you know.

tcebob

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Entmake Text misplaces the text.
« Reply #6 on: May 07, 2005, 05:36:13 PM »
Quote
PS I formatted the code for posting.

Bob,
That comment was given because the "MakeEntMake.lsp" output is not formatted,
so I formatted it for posting. Nothing to do with your post. I wish you could highlight
within the code formatting.

Michael, high praise indeed considering the source, thanks.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.