Author Topic: Text linked to a polyline  (Read 2014 times)

0 Members and 1 Guest are viewing this topic.

FELIX

  • Bull Frog
  • Posts: 245
Text linked to a polyline
« on: September 15, 2023, 04:22:40 PM »
Does anyone know how to explain why a text is linked to a polyline. I think it is not Autolisp but an AutoCAD command.
Attached is a text and a polyline. If you copy only the mtext and paste it into a new drawing, the number value is displayed as "####"
OK.

FELIX

  • Bull Frog
  • Posts: 245
Re: Text linked to a polyline
« Reply #1 on: September 15, 2023, 04:25:22 PM »
Attached is the file with the text and polyline.
OK.

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Text linked to a polyline
« Reply #2 on: September 15, 2023, 05:00:36 PM »
From the screenshot alone, looks like a basic AutoCAD FIELD to me.

FELIX

  • Bull Frog
  • Posts: 245
Re: Text linked to a polyline
« Reply #3 on: September 15, 2023, 05:53:01 PM »
Great. I researched and found FLD2TXT.VLX that converts FIELDs to TEXT and works perfectly.
OK.

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Text linked to a polyline
« Reply #4 on: September 16, 2023, 05:24:17 PM »
Something like this should do the same:

Code - Auto/Visual Lisp: [Select]
  1.     (   (not (setq ent (car (entsel)))))
  2.     (   (not (vlax-property-available-p (setq obj (vlax-ename->vla-object ent)) 'textstring t)))
  3.     (   (setq str (vla-get-textstring obj))
  4.         (vla-put-textstring obj "")
  5.         (vla-put-textstring obj str)
  6.     )
  7. )

   

« Last Edit: September 17, 2023, 09:49:04 AM by Lee Mac »

ribarm

  • Gator
  • Posts: 3310
  • Marko Ribar, architect
Re: Text linked to a polyline
« Reply #5 on: September 16, 2023, 05:49:37 PM »
Shouldn't 6th line be :

Code - Auto/Visual Lisp: [Select]
  1. ...
  2. ...
  3.  
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

BIGAL

  • Swamp Rat
  • Posts: 1434
  • 40 + years of using Autocad
Re: Text linked to a polyline
« Reply #6 on: September 16, 2023, 09:01:32 PM »
Agree Marco

Just a comment get actual field string use (vla-fieldcode obj)
A man who never made a mistake never made anything

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Text linked to a polyline
« Reply #7 on: September 17, 2023, 04:42:07 AM »
Does anyone know how to explain why a text is linked to a polyline. I think it is not Autolisp but an AutoCAD command.
Attached is a text and a polyline. If you copy only the mtext and paste it into a new drawing, the number value is displayed as "####"
Instead of coping the mtext only, try to copy both mtext and pline, it shall be ok

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Text linked to a polyline
« Reply #8 on: September 17, 2023, 04:49:27 AM »
instead typing suffix each time use additional format. as attached

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Text linked to a polyline
« Reply #9 on: September 17, 2023, 09:49:19 AM »
Shouldn't 6th line be :

Code - Auto/Visual Lisp: [Select]
  1. ...
  2. ...
  3.  

Thanks - updated.

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Text linked to a polyline
« Reply #10 on: September 17, 2023, 11:30:28 AM »
Something like this should do the same:

Code - Auto/Visual Lisp: [Select]
  1. ...
  2.         (vla-put-textstring obj "")
  3.         (vla-put-textstring obj str)
  4.     )
  5. )
Why did you use vla-put-textstring 2 times?

   

ribarm

  • Gator
  • Posts: 3310
  • Marko Ribar, architect
Re: Text linked to a polyline
« Reply #11 on: September 17, 2023, 12:28:02 PM »
Something like this should do the same:

Code - Auto/Visual Lisp: [Select]
  1. ...
  2.         (vla-put-textstring obj "")
  3.         (vla-put-textstring obj str)
  4.     )
  5. )
Why did you use vla-put-textstring 2 times?

   

I guess just making sure, to get rid of FIELD as textstring...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube