Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tell me how to extract the formula from the field object as a rehum.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ya312
421 Views, 4 Replies

Tell me how to extract the formula from the field object as a rehum.

soc.jpg

4 REPLIES 4
Message 2 of 5
cadffm
in reply to: ya312

"

Tell me how to extract the formula from the field object as a rehum"

As a WHAT? Can you explain in in other word or pictures?

Where and how do you want to use it "as rehum", whatever it is.

 

You can copy the fieldcode from the section below that line, but i am not sure if you ask for it.

 

Sebastian

Message 3 of 5
ya312
in reply to: cadffm

sorry..

Not the field code.
Extract field formula as lisp
See the picture.

 

osc.png

Message 4 of 5
cadffm
in reply to: cadffm


@cadffm  schrieb:

"Can you explain in in other word or pictures?

Where and how do you want to use it (it helps to understand what you really try to do and what you need)


Upload this sample file (dwg)

 

In your picture i can not see many informations and i can not see what you need.

Sebastian

Message 5 of 5
ya312
in reply to: ya312

(defun GetFieldCode (handle / tmp fld fldCounter subFldTxt fldNo fldList)
(setq tmp (entget (handent handle)))	; get the entity
(setq	fld
(entget
(cdr
(assoc
'360
(entget (cdr (assoc '360 (entget (cdr (assoc '360 tmp)))))
; get the field object
)
)
)
)
)

(setq fldtxt (cdr (assoc '2 fld)))	; get the field pattern string
(setq fldCounter 0)
(setq fldNo (cdr (assoc '90 fld)))	; number of fields
(setq	fldList	(vl-remove-if 'null (mapcar '(lambda (a) (if (= (car a) 360) a)) fld)))	; filter list of field entities
(while (< fldCounter fldNo)	; loop to the number of fields
(setq tmp (strcat "\\_FldIdx " (itoa fldCounter)))
; part of the field string to be replaced
(setq subFldTxt
(cdr (assoc '2 (entget (cdr (nth fldCounter fldList)))))
)	; get the actual field string for each sub field
(setq fldtxt (vl-string-subst subFldTxt tmp fldtxt))


; and replace it in the text string
(setq fldCounter (1+ fldCounter))
)

(setvar "USERS1" fldtxt)	; save the output field code to USERS1 system variable
(princ)
)

(defun C:TFC() ; Test GetFieldCode function
(setq hnd (cdr (assoc '5 (entget (car (nentsel)))))) ; gettign the entity handle
(GetFieldCode hnd)
(princ fldtxt)
(princ)
)
oc2.jpg


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report