rajuks Posted October 7, 2008 Share Posted October 7, 2008 Hello to all I am new to autocad. I am doing programming/customization for Microstation for last 4 years. But my new job requires autocad customization. I have a small question. I want to make a custom menu bar so that when operator selects any command from this menu, current layer name should change automatically and activates the desired command. for example , operator wants to draw a center line, then he will selects "cntrLine" command from my menu, then the active layer should change to "CenterLine" Layer ( which exists already) and simultaneously line command should activate. This is similar to sidebarmenu (sbm file) in Microstation. Can some one help me for this topic. Reagrds and thanks satya Quote Link to comment Share on other sites More sharing options...
NBC Posted October 7, 2008 Share Posted October 7, 2008 This would be much easier implemented in Tool Palettes. Quote Link to comment Share on other sites More sharing options...
GhostRider Posted October 7, 2008 Share Posted October 7, 2008 Yea you could do it a few different way I think, a small lisp for each button or as a lisp with all commands, called by each button, or add each command lisp to the acad.lsp , and in the tool pallet also, I use them in both toolbars and pallets, I'm no expert but I use small lisps like this. ^C^C(cont) ^P(PROGN (command "layer" "t" "[color=red]centerline[/color]" "s" "[color=#ff0000]centerline[/color]" "f" "*" "t" "0,defpoints" "")(command "line")(princ)) and add other commands as well Quote Link to comment Share on other sites More sharing options...
StevJ Posted October 7, 2008 Share Posted October 7, 2008 I do similar setups where I work. The following macro does it for me. ^C^C-LAYER;SET;CenterLine;ON;;;_line Quote Link to comment Share on other sites More sharing options...
rajuks Posted October 10, 2008 Author Share Posted October 10, 2008 Thank you all of you for your suggestions. I don't know anything about auto lisp. I am good in VBA. i will try to work on your suggestions. Thank you very much satya Quote Link to comment Share on other sites More sharing options...
rocheey Posted October 14, 2008 Share Posted October 14, 2008 Thank you all of you for your suggestions. I don't know anything about auto lisp. I am good in VBA. i will try to work on your suggestions. Thank you very much satya heres a quick and dirty, half of which was stolen from the help files. It creates a toolbar on the fly, and attaches VBA subroutines to each of the buttons it adds. Hope it gets you started. Sub ToolbarButton() Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0) ' Create the new toolbar Dim newToolBar As AcadToolbar Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar5") ' Add a button to the new toolbar Dim newButton1 As AcadToolbarItem, newButton2 As AcadToolbarItem Dim openMacro1 As String, openMacro2 As String ' Assign the macro string the VB equivalent of "ESC ESC _open " openMacro1 = "-VBARUN " & "SampleSub1" & " " ' add a space to enmnu item to emulate the ENTER key]' Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Sample Macro 1", openMacro1) ' Assign the macro string the VB equivalent of "ESC ESC _open " openMacro2 = "-VBARUN " & "SampleSub2" & " " ' add a space to enmnu item to emulate the ENTER key]' Set newButton2 = newToolBar.AddToolbarButton("", "NewButton2", "Sample Macro 2", openMacro2) ' Display the toolbar newToolBar.Visible = True End Sub Sub SampleSub1() Dim tmpLayer As AcadLayer Set tmpLayer = ThisDrawing.Layers.Item("0") ThisDrawing.ActiveLayer = tmpLayer ThisDrawing.SendCommand "Line " End Sub Sub SampleSub2() Dim tmpLayer As AcadLayer Set tmpLayer = ThisDrawing.Layers.Item("0") ThisDrawing.ActiveLayer = tmpLayer ThisDrawing.SendCommand "Circle " End Sub Quote Link to comment Share on other sites More sharing options...
NOELCAD Posted October 17, 2008 Share Posted October 17, 2008 i'm looking for the create lisp or run lisp in acad..2008 can't find the option.. can someone help me please or direct.. Quote Link to comment Share on other sites More sharing options...
dumfatnhappy Posted October 17, 2008 Share Posted October 17, 2008 Hello to all I am new to autocad. I am doing programming/customization for Microstation for last 4 years. But my new job requires autocad customization. I have a small question. I want to make a custom menu bar so that when operator selects any command from this menu, current layer name should change automatically and activates the desired command. for example , operator wants to draw a center line, then he will selects "cntrLine" command from my menu, then the active layer should change to "CenterLine" Layer ( which exists already) and simultaneously line command should activate. This is similar to sidebarmenu (sbm file) in Microstation. Can some one help me for this topic. Reagrds and thanks satya welcome rajuks, so yet another soul makes it over from the "dark side" congratulations! Quote Link to comment Share on other sites More sharing options...
Irish Posted October 23, 2008 Share Posted October 23, 2008 welcome rajuks, so yet another soul makes it over from the "dark side" congratulations! Yeah, to the model space. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.