Subtract text from a list

Subtract text from a list

carlos_m_gil_p
Advocate Advocate
964 Views
6 Replies
Message 1 of 7

Subtract text from a list

carlos_m_gil_p
Advocate
Advocate

Hello boys how are you.

 

I have this list stored in a variable.

 

(setq lst-dxf-panel '(-3 ("MELIA_MPANE" (1000 . "Edge = Weft") (1000 . "Panel ID = 1.1"))))


As I can subtract the value of Panel ID

In this case "1.1"

 

Thanks for your help and excuse my English.


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

0 Likes
Accepted solutions (1)
965 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

(substr (cdar (cddadr lst)) 12)

 

or

 

(substr (cdr (assoc 1000 (reverse (cadr lst)))) 12)

0 Likes
Message 3 of 7

carlos_m_gil_p
Advocate
Advocate

Hi BeekeeCZ, How are you.
Thanks for your help.

 

I did the tests but if Panel ID is in the other side of the list does not work for me.

 

The Panel ID ubicaion may vary.

 

 

(setq lst-dxf-panel '(-3 ("MELIA_MPANE" (1000 . "Edge = Warp") (1000 . "Panel ID = 1.1") (1000 . "Description = created by mesh to panel, panel 1") (1000 . "Shear Strain =0.393%") )))

 

Thanks


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

0 Likes
Message 4 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution
Try then... (substr (cdar (vl-remove-if-not '(lambda (x) (wcmatch (cdr x) "Panel ID*")) (cdadr lst-dxf-panel))) 12)
0 Likes
Message 5 of 7

carlos_m_gil_p
Advocate
Advocate
It works very well, thank you very much.

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

0 Likes
Message 6 of 7

john.uhden
Mentor
Mentor
(setq lst-dxf-panel
  '(-3
     ("MELIA_MPANE"
        (1000 . "Edge = Weft")
        (1000 . "Panel ID = 1.1")
     )
   )
)
(setq ID
  (car
    (vl-remove-if-not
      '(lambda (x)(wcmatch (cdr x) "Panel ID*"))
       (cdadr lst-dxf-panel)
    )
  )
)
;; returns (1000 . "Panel ID = 1.1")
(setq old (substr (cdr ID) 12))
;; returns "1.1"
(setq additive -0.1)
(setq new (+ (atof old) additive))
;; returns 1.0
(setq new (rtos new 2 1))
;; returns "1.0"
(setq new (cons 1000 (strcat "Panel ID = " new)))
;; returns '(1000 . "Panel ID = 1.0")
(setq new (subst new ID (cadr lst-dxf-panel)))
(setq rev-dxf-panel (cons -3 (list new)))

John F. Uhden

0 Likes
Message 7 of 7

carlos_m_gil_p
Advocate
Advocate

Thanks john.uhden

 


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

0 Likes