LISP by LeeMac SumAttributes.lsp | Version 1.1 to small edit

LISP by LeeMac SumAttributes.lsp | Version 1.1 to small edit

karpki
Advocate Advocate
2,609 Views
10 Replies
Message 1 of 11

LISP by LeeMac SumAttributes.lsp | Version 1.1 to small edit

karpki
Advocate
Advocate

Hi

The LISP is brilliant ang gives such result in the test file:

karpki_0-1617647882587.png

I need to hide first 4 digits from the name of the tag:

karpki_1-1617647934545.png

Before I used to add this kind of code for this purpose:

(setq lname(substr (setq str2 (car d)) 5 (- (strlen str2) 0)))

(vla-setCellValue Area_table crow 0 lname)

 

But here in this LISP I don't understand where to put something like that

 

Help needed please!

 

Thank you in advance for your interest!

 

BR

K

0 Likes
Accepted solutions (2)
2,610 Views
10 Replies
Replies (10)
Message 2 of 11

karpki
Advocate
Advocate

Forgot to tell, the simple correction of tag names is not the right way!

0 Likes
Message 3 of 11

devitg
Advisor
Advisor

@karpki  I try it , but do not work 

 

(and (setq tag (if (cdr lst) (LM:listbox "Select Tags to Display" (mapcar 'car lst) 1) (mapcar 'car lst)))
                 (setq ins (getpoint "\nSpecify point for table: "))
                 ;(setq  tag (list (substr (car tag) 5 (- (strlen (car tag)) 0))))
            )
0 Likes
Message 4 of 11

Lee_Mac
Advisor
Advisor

I'm pleased that you find my Sum Attributes program so useful.

 

To remove the first 4 characters from the displayed tag name, change line 112 from:

(setq lst (attsum:assoc++ (strcase (vla-get-tagstring att)) (fun att val) lst))

To:

(setq lst (attsum:assoc++ (strcase (if (< 4 (strlen (vla-get-tagstring att))) (substr (vla-get-tagstring att) 5) (vla-get-tagstring att))) (fun att val) lst))

 

Message 5 of 11

karpki
Advocate
Advocate

Hi Lee, glad to hear from you!

Thank you for your reply!

Indeed it was minused but the data order became wrong:

karpki_0-1617732531540.png

Ii should start from WF in this list

How to turn it back ?

Best Regards

K

0 Likes
Message 6 of 11

karpki
Advocate
Advocate

Hidden figures in the tag name should make an order in the tab.

Probably this is not possible here in this logic.

Normally I will have a list of 50-100 tag names and they should be in the correct order according the figures in the beggining of the name

But those figures are quite bad presenting in tab to see them

 

0 Likes
Message 7 of 11

Lee_Mac
Advisor
Advisor
Accepted solution

In that case, revert to the original code, and instead change lines 120-122 from:

        (   (and (setq tag (if (cdr lst) (LM:listbox "Select Tags to Display" (mapcar 'car lst) 1) (mapcar 'car lst)))
                 (setq ins (getpoint "\nSpecify point for table: "))
            )

To:

        (   (and (setq lst (mapcar '(lambda ( x ) (if (< 4 (strlen (car x))) (list (substr (car x) 5) (cadr x)) x)) lst))
                 (setq tag (if (cdr lst) (LM:listbox "Select Tags to Display" (mapcar 'car lst) 1) (mapcar 'car lst)))
                 (setq ins (getpoint "\nSpecify point for table: "))
            )

 

 

Message 8 of 11

karpki
Advocate
Advocate

Thank you!

Superb!

 

0 Likes
Message 9 of 11

karpki
Advocate
Advocate

Oh, no!

Yes, it builds the tab by the correct order but

Unfortunatelly it ignores all the blocks and count only one of each different name

karpki_0-1617816519925.png

 

0 Likes
Message 10 of 11

Lee_Mac
Advisor
Advisor
Accepted solution

Apologies - it should be the following:

        (   (and (setq lst (mapcar '(lambda ( x ) (if (< 4 (strlen (car x))) (cons (substr (car x) 5) (cdr x)) x)) lst))
                 (setq tag (if (cdr lst) (LM:listbox "Select Tags to Display" (mapcar 'car lst) 1) (mapcar 'car lst)))
                 (setq ins (getpoint "\nSpecify point for table: "))
            )

 

Message 11 of 11

karpki
Advocate
Advocate

Yes!!!!!!!!!!!!!!!

Thank you very much!

 

0 Likes