Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA to VLISP

4 REPLIES 4
Reply
Message 1 of 5
dolives
757 Views, 4 Replies

VBA to VLISP

Hi,

How can i translate VBA syntax :

 

 currMenuGroup.Menus.item(i).item(j).SubMenu.item(k).Caption

 

In VLISP

 

I want to find a submenu in a partial menu like :

 

TPS

     " Test"

"Subtest-versionnumber"

To compare the version number !

 

Thank you very much for your help

Daniel OLIVES

(french user)

4 REPLIES 4
Message 2 of 5
Moshe-A
in reply to: dolives

Daniel,

 

; get root pointer to menus
(setq menuGrp (vla-get-menugroups (vlax-get-acad-object)))

; get a pointer to acad.cuix file
(setq acadcui (vla-item menuGrp "acad"))

; get the menus
(setq menus (vla-get-menus acadcui))

; get file menu
(setq file-menu (vla-item menus "&File"))

 ; get the first  menu item
(setq item1 (vla-item file-menu 0))
 ; get the second menu item
(setq item2 (vla-item file-menu 2))
.......
.......
; get the fivth  menu item
(setq item5 (vla-item file-menu 5))

; get caption
(setq caption5 (vla-get-caption item5)) ; return "&Close"

 

Cheers,

Moshe

 

Message 3 of 5
dolives
in reply to: Moshe-A

Hi,

Thank you for your help.

 

I find a direct way without any control !

(setq LabelSubMenu 
	(vlax-get-property 
		(vla-item 
			(vla-get-submenu 
				(vlax-invoke-method 
					(vla-item 
						(vla-get-Menus 
							(vla-item 
								(vla-get-MenuGroups 
									(vlax-get-acad-object)
								)
								0
							)
						) 
						0
					) 
					'Item 
					20
				)
			) 
			0
		) 
		'label
	)
)

 

The menu index for my exemple is "20" and in submenu first so "0" !

 

I search a best way and post it !

 

 Daniel OLIVES

 

 

Message 4 of 5
dolives
in reply to: dolives

HI,

Screen shot menu !

 

Daniel OLIVES

Message 5 of 5
dolives
in reply to: dolives

Hi,

I use this way to an automatic reload of mpartial menu when I update it.

I control if the labet of version is correct and if not i reload !

It work in VBA, but before migrate to dot net, i convert all in VLISP !

It is a good exercice !

Because i think it is very important to know how do al things in VLISP or LISP in AutoCAD so after it was easy to know how is possible or not !

 

Daniel OLIVES

 

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

Post to forums  

Autodesk Design & Make Report

”Boost