Help with tab order number

Help with tab order number

msarqui
Collaborator Collaborator
2,013 Views
7 Replies
Message 1 of 8

Help with tab order number

msarqui
Collaborator
Collaborator

Hi guys,

 

How can I get the tab order number of the current layout?

 

The following routine gives me a list with the tab order number associated with the layout name. (thanks to hmsilva)

(defun c:GetLayNumber ( / doc lst)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for layout (vla-get-layouts doc)
	(if (not (eq "MODEL" (strcase (vla-get-name layout))))
		(setq lst (cons (list (vla-get-taborder layout) (vla-get-name layout)) lst))
	);if
);vlax
(setq lst (vl-sort lst (function (lambda (a b) (< (car a) (car b))))))
(setq lstfinal lst) ;;;Do something here to extract the tab order number associated with the current tab )

Now, lets say I want to put in a variable, only the tab order number of the current layout (getvar "ctab").

Any help please?

Thanks

Marcelo

0 Likes
Accepted solutions (1)
2,014 Views
7 Replies
Replies (7)
Message 2 of 8

hmsilva
Mentor
Mentor
Accepted solution

Hi Marcelo,

one way...

 

(if (/= (getvar 'ctab) "Model")
   (foreach x lstfinal
      (if (= (cadr x) (getvar 'ctab))
         (setq CurrentTabOrder (car x))
      )
   )
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 8

msarqui
Collaborator
Collaborator
Many thanks Henrique. I can see the logic!
0 Likes
Message 4 of 8

hmsilva
Mentor
Mentor

@msarqui wrote:
Many thanks Henrique. I can see the logic!

You're welcome, Marcelo!

Depending on your goal, you can also consider in building the list as a dottet pair list, and just test an association...

 

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for layout (vla-get-layouts doc)
    (if (not (eq "MODEL" (strcase (vla-get-name layout))))
        (setq lst (cons (cons (vla-get-name layout) (vla-get-taborder layout)) lst))
    )
)
(setq lst (vl-sort lst (function (lambda (a b) (< (cdr a) (cdr b))))))
(if (setq CurrentTabOrder (assoc (getvar 'ctab) lst))
    (setq CurrentTabOrder (cdr CurrentTabOrder))
)

 

Hope this helps,
Henrique

EESignature

Message 5 of 8

msarqui
Collaborator
Collaborator
Interesting, I will give a look.
Thanks
Marcelo
0 Likes
Message 6 of 8

S_S_SS
Advocate
Advocate

Hello sir,
excuse me i want to get the number of current layout sheet in a text field can you help me please ? 

0 Likes
Message 7 of 8

hmsilva
Mentor
Mentor

@S_S_SS wrote:

Hello sir,
excuse me i want to get the number of current layout sheet in a text field can you help me please ? 


Hello @S_S_SS  

try this code from @Lee_Mac 

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 8 of 8

S_S_SS
Advocate
Advocate

thanks for help sir ,
when i copy this text to another drawing it give me  Sheet#of-1 and it needed to make my order (lfsheet) and select it to activate it 
can you help me about this ? 

 

0 Likes