Jump to content

insert a field using LISP


nod684

Recommended Posts

Привет, Ли. Подскажи, пожалуйста, как с помощью Quick Field  создать поле суммы нескольких текстов.

10+50+80=поле суммы

Link to comment
Share on other sites

On 1/4/2023 at 5:11 PM, Nikon said:

Привет, Ли. Подскажи, пожалуйста, как с помощью Quick Field  создать поле суммы нескольких текстов.

10+50+80=поле суммы

%<\AcExpr (%<\_FldPtr 959588656>%+%<\_FldPtr 959592752>%+%<\_FldPtr 959592208>%)>%

 

 

Edited by Nikon
Link to comment
Share on other sites

  • 1 month later...
On 11/13/2015 at 6:14 PM, catopal said:

Hi Lee,

 

How can I get dynamic block user parameter value with QuickField lisp. ?

 

 

%<\AcObjProp Object(%<\_ObjId 140694963280112>%).Parameter(96).UpdatedDistance \f "%lu2%pr0">%
 

 



I think you can use a part of Lee Mac's code.
I could adjust it to retrieve field-code of a specific attribute inside my dynamic block.
In your case:
Parameter(96) points to  specific parameter. If you want to always retrieve field of the same parameter from different blocks, it can stay the same.
What concerns parameters, the lucky thing is that ObjId of any parameter is the same as of the Insert-entity itself.
I believe smth. like this should work:

(strcat
  "%<\AcObjProp Object(%<\_ObjId "
  (vla-getobjectidstring
			(vla-get-utility
			  (vla-get-activedocument (vlax-get-acad-object)))
			(vlax-ename->vla-object (car (entsel))) :vlax-false)
  ">%).Parameter(96).UpdatedDistance \f "%lu2%pr0">%")


where:
 

(vla-get-activedocument (vlax-get-acad-object)))

 is a simplification of Lee's "LM:quickfield:acdoc", which I didn't entirely understand, due to my lack of experience :) Maybe Lee uses it to save space ?)

Link to comment
Share on other sites

20 hours ago, Kycau said:
(vla-get-activedocument (vlax-get-acad-object)))

 is a simplification of Lee's "LM:quickfield:acdoc", which I didn't entirely understand, due to my lack of experience :) Maybe Lee uses it to save space ?)

 

Perhaps this post will help to shed some light :)

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 2/9/2015 at 2:29 PM, Lee Mac said:

 

(defun c:test ( ) (LM:QuickField "TextString" "%tc1" 1))
 

 

EDIT:

Never mind and thanks, I found my answer here:
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/link-between-text-mtext-and-attribute-with-field/m-p/6265346/highlight/true#M340500

 

@Lee Mac

Hi Lee,

I need to replace the contents of a text object with multiple textstring fields separated by a delimiter "-", by selecting multiple text objects in order.

E.g. If I select text1 then text3 then text2, and hit enter, i pick an existing text to replace its contents with text1-text3-text2 as fields.

Is this possible with your Quick Field program?

Thanks

 

Edited by enthralled
Found answer
Link to comment
Share on other sites

It may be easier to try this expects that you are picking 3 field text objects, expects that the destination mtext exists.

 

; pick multi mtext and paste into another mtext
; By AlanH March 2024

(defun c:wow ( / txt1 txt2 txt3 obj4)

(setq txt1 (vlax-ename->vla-object (car  (entsel "Pick 1st text object "))))
(setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId "
          (itoa (vla-get-objectid txt1))
		  ">%).TextString>%"
          )
)

(setq txt2 (vlax-ename->vla-object (car  (entsel "Pick 2nd text object "))))
(setq str (strcat str "-" "%<\\AcObjProp Object(%<\\_ObjId "
          (itoa (vla-get-objectid txt2))
		  ">%).TextString>%"
          )
)

(setq txt3 (vlax-ename->vla-object (car  (entsel "Pick 3rd text object "))))
(setq str (strcat str "-" "%<\\AcObjProp Object(%<\\_ObjId "
          (itoa (vla-get-objectid txt3))
		  ">%).TextString>%"
          )
)

(setq obj4  (vlax-ename->vla-object (car  (entsel "Pick destination text "))))

(vlax-put obj4 'textstring str)
(princ)
)

image.png.efaa6a3d7f880d76bb38bc7a6a9c61e4.png

Edited by BIGAL
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
On 2/6/2015 at 5:28 PM, Lee Mac said:

You could create a program using my Quick Field utility to perform this task.

 

Amazing! this solves a LOT of very tedious tasks.

 

Thanks a bunch!

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...