TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on December 10, 2019, 08:39:52 AM

Title: How to convert Field to String to use in Entmake in the code
Post by: HasanCAD on December 10, 2019, 08:39:52 AM
I am wondering is it possible to convert a field to a string to use in Entmakex
 
I extracted the scale using
Code - Auto/Visual Lisp: [Select]
  1.     (setq enam (car (nentsel "\nSelect Viewport: ")))
  2.     (setq objid (vla-get-objectid (vlax-ename->vla-object enam)))
  3.     (setq fldexp (strcat "Scale : " "%<\\AcObjProp Object(%<\\_ObjId " (itoa objid) " >%).StandardScale2 \\f \"%en0\">%"))


Thanks in advance


Title: Re: How to convert Field to String to use in Entmake in the code
Post by: ronjonp on December 10, 2019, 09:03:35 AM
Have you see this? http://www.lee-mac.com/quickfield.html
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: Lee Mac on December 10, 2019, 01:41:44 PM
I am wondering is it possible to convert a field to a string to use in Entmakex

I would advise against using entmake(x) to create a field as it requires a not insignificant amount of code (http://www.theswamp.org/index.php?topic=20446) to create the associated extensionary dictionaries which underpin the field functionality; conversely, a simple (vla-put-textstring <obj> <field expression>) using ActiveX will create such dictionaries for you automatically.
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: HasanCAD on December 11, 2019, 12:29:49 AM
I am trying to modify LEE lisp http://www.lee-mac.com/vpoutline.html  (Thanks LEE)
to add sheet number and scale of the viewport but I the result like attached
Due to the viewport in a layout and the text in model
So What comes in mind to convert the field to string and I am asking for thant.
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: HasanCAD on December 11, 2019, 04:19:33 AM
When close the file and open again it works
Thanks for all
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: BIGAL on December 11, 2019, 10:19:42 PM
Using VL you can set the viewport scale

(vla-put-CustomScale viewport yourscale)

Then use zoom c scale
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: ronjonp on December 12, 2019, 11:20:03 AM
When close the file and open again it works
Thanks for all
You might check your FIELDEVAL setting too.
Title: Re: How to convert Field to String to use in Entmake in the code
Post by: PKENEWELL on December 12, 2019, 03:51:31 PM
When close the file and open again it works
Thanks for all

Perhaps incorporate a call to the command UPDATEFIELD and select the previously created text?