Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
dolives
Posts: 207
Registered: ‎09-04-2002
Message 1 of 5 (451 Views)

VBA to VLISP

451 Views, 4 Replies
05-11-2012 01:34 AM

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)

Distinguished Mentor
Moshe-A
Posts: 827
Registered: ‎09-14-2003
Message 2 of 5 (441 Views)

Re: VBA to VLISP

05-11-2012 03:30 AM 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

 

Distinguished Contributor
dolives
Posts: 207
Registered: ‎09-04-2002
Message 3 of 5 (433 Views)

Re: VBA to VLISP

05-11-2012 05:25 AM 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

 

 

Distinguished Contributor
dolives
Posts: 207
Registered: ‎09-04-2002
Message 4 of 5 (432 Views)

Re: VBA to VLISP

05-11-2012 05:27 AM in reply to: dolives

HI,

Screen shot menu !

 

Daniel OLIVES

Distinguished Contributor
dolives
Posts: 207
Registered: ‎09-04-2002
Message 5 of 5 (430 Views)

Re: VBA to VLISP

05-11-2012 05:33 AM 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

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.