Extract value DXF -3

Extract value DXF -3

carlos_m_gil_p
Advocate Advocate
981 Views
5 Replies
Message 1 of 6

Extract value DXF -3

carlos_m_gil_p
Advocate
Advocate

Hello how are you.

 

I have a group of entities in a drawing.

Some associated with the code dxf -3

 

If I extract the value of one

 

 

(setq lst-dxf-polyref '(-3 ("MELIAR_MPANEL" (1000 . "* = Truncate") (1000 . "Panel ID = 3.5") (1000 . "Poly ref = 1128"))))

 

I need to know what was the last value of Poly ref
Or which is the highest value of Poly ref used throughout the drawing.


In this example it would be "1128"

 

But not by entity, but all the drawing.
There may be many or none.

 

I hope you can help me.

 

Thank you very much and excuse my English, I only speak Spanish.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Accepted solutions (1)
982 Views
5 Replies
Replies (5)
Message 2 of 6

Ranjit_Singh
Advisor
Advisor
(setq ss1 (ssget "_x" '((-3 ("MELIAR_MPANEL")))))
(apply 'max (mapcar '(lambda (x) (read (substr (cdr (last (cadr (assoc -3 (entget (cadr x) '("*")))))) 12))) (ssnamex ss1)))

 

It has nothing to do with what you select, unless you want to report the current value and the max value?

0 Likes
Message 3 of 6

Kent1Cooper
Consultant
Consultant

@Ranjit_Singh wrote:
....
(apply 'max (mapcar '(lambda (x) (read (substr (cdr (last (cadr (assoc -3 ....

....


... unless, as in the OP's other recent topic, that "Poly ref = xxxx" entry may not always be the last one in the list.

Kent Cooper, AIA
0 Likes
Message 4 of 6

Ranjit_Singh
Advisor
Advisor
Accepted solution

Good point. I was not aware of the other post.

 

(apply 'max (vl-remove nil (apply 'append (mapcar '(lambda (y) (mapcar '(lambda (x) (if (listp x) (if (wcmatch (cdr x) "Poly ref = *") (read (substr (cdr x) 12))))) (cadr (assoc -3 (entget (cadr y) '("MELIAR_MPANEL")))))) (ssnamex ss1)))))
0 Likes
Message 5 of 6

carlos_m_gil_p
Advocate
Advocate

Hello how are you.
Thanks to all for the help.

 

It works well.

But I have a question.

 

I thought I would have to look for the APPI (tblsearch "appid" "MELIAR_MPANEL")
And work from there.

 

I think if there are lots of entities is very slow.
Or if the entity is in a block.

 

They think?


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 6 of 6

marko_ribar
Advisor
Advisor

Carlos, a side question for you...

 

How did you get MPANEL plugin? Was it through www... If so can you please provide a link for downaload? If you wish I have EDGENET-FINAL.LSP that works fine all up to 64x64 M-N direction divisions, and network is now fine like in your example posted on theswamp.org - new algorithm is using barycenter of 4 orthogonal surrounding points and it's applied for every part of network... Can you please shed some light on this plugin? If you wish you can PM on my mail and we can exchange my lisp and plugin... Also if you have full version, I may agree to give you link of my LISP library of routines which are very useful for many tasks... Currently archive is around 615MB zipped, so when you unpack it's over 1GB... My mail : ribarm@gmail.com

 

Thanks for any answer...

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes