Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AddInSample

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
368 Views, 12 Replies

AddInSample

I followed exactly step-by-step showing in the program help. After compile the DLL register the registry, run IV, I couldn't see the AddIn Sample Toolbar in the Panel bar Anyone experieced this before, Please give out a hint. Thanks.
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

Select Tools > Add-ins from the menu. Does the add-in appear in the list? If so, does it show as loaded? Neil "Calimesa" wrote in message news:41827287_2@newsprd01... >I followed exactly step-by-step showing in the program help. After compile > the DLL register the registry, run IV, I couldn't see the AddIn Sample > Toolbar in the Panel bar > Anyone experieced this before, Please give out a hint. > Thanks. > >
Message 3 of 13
Anonymous
in reply to: Anonymous

yes, I saw it in the Tool>Add-ins and loaded. "Neil Munro" wrote in message news:418273cb$1_3@newsprd01... > Select Tools > Add-ins from the menu. Does the add-in appear in the list? If > so, does it show as loaded? > > Neil > > "Calimesa" wrote in message > news:41827287_2@newsprd01... > >I followed exactly step-by-step showing in the program help. After compile > > the DLL register the registry, run IV, I couldn't see the AddIn Sample > > Toolbar in the Panel bar > > Anyone experieced this before, Please give out a hint. > > Thanks. > > > > > >
Message 4 of 13
Anonymous
in reply to: Anonymous

What IV version? The help file Add-In sample program does not create any buttons or toolbars. Did you add code to do this? Could you post the code from the .cls file? Neil "Calimesa" wrote in message news:4182746c_1@newsprd01... > yes, I saw it in the Tool>Add-ins and loaded. > > "Neil Munro" wrote in message > news:418273cb$1_3@newsprd01... >> Select Tools > Add-ins from the menu. Does the add-in appear in the list? > If >> so, does it show as loaded? >> >> Neil >> >> "Calimesa" wrote in message >> news:41827287_2@newsprd01... >> >I followed exactly step-by-step showing in the program help. After > compile >> > the DLL register the registry, run IV, I couldn't see the AddIn Sample >> > Toolbar in the Panel bar >> > Anyone experieced this before, Please give out a hint. >> > Thanks. >> > >> > >> >> > > >
Message 5 of 13
Anonymous
in reply to: Anonymous

Option Explicit Implements ApplicationAddInServer Private oApp As Inventor.Application Private WithEvents oButtonHandler1 As ButtonDefinitionHandler Private WithEvents oButtonHandler2 As ButtonDefinitionHandler Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As Inventor.ApplicationAddInSite _ , ByVal FirstTime As Boolean) ' Save a reference to the Application object. Set oApp = AddInSiteObject.Application ' Create the two button handlers. To simplify this sample the icons ' are read from disk. They could also have been obtained from other ' various sources such as an image list control or a resource file. ' Also, to simplify this sample only small buttons are used. Inventor ' will scale them if large buttons are selected by the user. Dim oIcon1 As IPictureDisp Dim oIcon2 As IPictureDisp Set oIcon1 = LoadPicture(App.Path & "\Slot.ico") Set oIcon2 = LoadPicture(App.Path & "\Toggle.ico") Set oButtonHandler1 = AddInSiteObject.CreateButtonDefinitionHandler("AddInSampleCmd1", _ kShapeEditCmdType, "Draw Slot", "Create slot sketch graphics", _ "Draw Slot", oIcon1, oIcon1) Set oButtonHandler2 = AddInSiteObject.CreateButtonDefinitionHandler("AddInSampleCmd2", _ kQueryOnlyCmdType, "Toggle Slot State", "Enables/Disables state of slot command.", _ "Toggle Slot State", oIcon2, oIcon2) ' Create a new command bar Dim oCommandBar As CommandBarBase Set oCommandBar = oApp.EnvironmentBaseCollection.CommandBarBaseCollection.Add("AddIn Sample") ' Add buttons to the command bar for the two handlers. Call oCommandBar.Controls.Add(kBarControlButton, oButtonHandler1.ControlDefinition) Call oCommandBar.Controls.Add(kBarControlButton, oButtonHandler2.ControlDefinition) ' Get the 2d sketch environment base object. Dim oEnvBase As EnvironmentBase Set oEnvBase = oApp.EnvironmentBaseCollection.Item("PMxPartSketchEnvironment") ' Make this command bar accessable in the panel menu for the 2d sketch environment. oEnvBase.PanelBarList.Add oCommandBar MsgBox "To access the commands of the sample add-in, activate a 2d sketch in a part" & Chr(13) & _ "document and select the ""AddIn Sample"" toolbar within the panel menu." End Sub Private Property Get ApplicationAddInServer_Automation() As Object Set ApplicationAddInServer_Automation = Nothing End Property Private Sub ApplicationAddInServer_Deactivate() ' Release all references. Set oButtonHandler1 = Nothing Set oButtonHandler2 = Nothing Set oApp = Nothing End Sub Private Sub ApplicationAddInServer_ExecuteCommand(ByVal CommandID As Long) ' No longer used. End Sub Private Sub oButtonHandler1_OnClick() ' Check to make sure a sketch is active. If TypeOf oApp.ActiveEditObject Is PlanarSketch Then ' Call the method to draw the sketch. Call DrawSlot(oApp.ActiveEditObject) Else ' No sketch is active so display an error. MsgBox "A sketch must be active for this command." End If End Sub Private Sub oButtonHandler2_OnClick() ' Toggle the enabled state of command 1. If oButtonHandler1.Enabled Then oButtonHandler1.Enabled = False Else oButtonHandler1.Enabled = True End If End Sub Private Sub DrawSlot(oSketch As PlanarSketch) Dim oLines(1 To 2) As SketchLine Dim oArcs(1 To 2) As SketchArc Dim oTransGeom As TransientGeometry ' Start a transaction so the slot will be within a single undo step. Dim oTrans As Transaction Set oTrans = oApp.TransactionManager.StartTransaction(oApp.ActiveDocument, "Create Slot") ' Draw the lines and arcs that make up the shape of the slot. With oApp.TransientGeometry Set oLines(1) = oSketch.SketchLines.AddByTwoPoints( _ .CreatePoint2d(0, 0), .CreatePoint2d(5, 0)) Set oArcs(1) = oSketch.SketchArcs.AddByCenterStartEndPoint( _ .CreatePoint2d(5, 1), oLines(1).EndSketchPoint, _ .CreatePoint2d(5, 2)) Set oLines(2) = oSketch.SketchLines.AddByTwoPoints( _ oArcs(1).EndSketchPoint, .CreatePoint2d(0, 2)) Set oArcs(2) = oSketch.SketchArcs.AddByCenterStartEndPoint( _ .CreatePoint2d(0, 1), oLines(2).EndSketchPoint, _ oLines(1).StartSketchPoint) End With ' Create the tangent constraints between the lines and arcs. Call oSketch.GeometricConstraints.AddTangent(oLines(1), oArcs(1)) Call oSketch.GeometricConstraints.AddTangent(oLines(2), oArcs(1)) Call oSketch.GeometricConstraints.AddTangent(oLines(2), oArcs(2)) Call oSketch.GeometricConstraints.AddTangent(oLines(1), oArcs(2)) ' Create a parallel constraint between the two lines. Call oSketch.GeometricConstraints.AddParallel(oLines(1), oLines(2)) ' End the transaction. oTrans.End End Sub "Neil Munro" wrote in message news:41827907_3@newsprd01... > What IV version? The help file Add-In sample program does not create any > buttons or toolbars. Did you add code to do this? Could you post the code > from the .cls file? > > Neil > > "Calimesa" wrote in message > news:4182746c_1@newsprd01... > > yes, I saw it in the Tool>Add-ins and loaded. > > > > "Neil Munro" wrote in message > > news:418273cb$1_3@newsprd01... > >> Select Tools > Add-ins from the menu. Does the add-in appear in the list? > > If > >> so, does it show as loaded? > >> > >> Neil > >> > >> "Calimesa" wrote in message > >> news:41827287_2@newsprd01... > >> >I followed exactly step-by-step showing in the program help. After > > compile > >> > the DLL register the registry, run IV, I couldn't see the AddIn Sample > >> > Toolbar in the Panel bar > >> > Anyone experieced this before, Please give out a hint. > >> > Thanks. > >> > > >> > > >> > >> > > > > > > > >
Message 6 of 13
Anonymous
in reply to: Anonymous

Did you have all sessions of Inventor completely closed when you registered the DLL after compiling? Even an Inventor.exe running in the background will stop the DLL register, check task manager. -- Paul Houlker Rimex Supply Ltd www.rimex.com "Calimesa" wrote in message news:41827287_2@newsprd01... > I followed exactly step-by-step showing in the program help. After compile > the DLL register the registry, run IV, I couldn't see the AddIn Sample > Toolbar in the Panel bar > Anyone experieced this before, Please give out a hint. > Thanks. > >
Message 7 of 13
Anonymous
in reply to: Anonymous

Ok, I see this is from IV8. Is that the latest version you have on the machine? The toolbar setup uses the IV8 methods whch are no longer officially supported in IV9 (but should work). I have both 8 and 9 here and there seems to be an issue with the line: oEnvBase.PanelBarList.Add oCommandBar oCommandBar is a CommandBarBase object and the .Add method wants a CommandBar (should not be a problem but it fails with a Type Mismatch error). I'm not sure if having both versions is causing the problem. If you customize the UI, does the toolbar show up in the list. It does for me if I comment out the above line. You can them manually add it to the 2D sketch environment. Anyone else have any ideas? Neil
Message 8 of 13
Anonymous
in reply to: Anonymous

didn't that sample add a whole new panelbar? I remember looking at one of the new samples a while back and I couldn't find the toolbars right away, but then noticed a new item in the panel bar changer. I haven't really looked over the code posted, so hopefully it isn't too obvous that I am off -- Kent Keller Autodesk Discussion Forum Facilitator "Neil Munro" wrote in message news:4182c14d_3@newsprd01... > oEnvBase.PanelBarList.Add oCommandBar >
Message 9 of 13
Anonymous
in reply to: Anonymous

oEnvBase is set to the 2D Sketch environment so it should add it a command bar in the 2D sketch environment, but I can't get it to run here. Neil "Kent Keller" wrote in message news:4182c399_1@newsprd01... > didn't that sample add a whole new panelbar? I remember looking at one of > the new samples a while back and I couldn't find the toolbars right away, > but then noticed a new item in the panel bar changer. > > I haven't really looked over the code posted, so hopefully it isn't too > obvous that I am off > > -- > Kent Keller > Autodesk Discussion Forum Facilitator > > > "Neil Munro" wrote in message > news:4182c14d_3@newsprd01... > > > > oEnvBase.PanelBarList.Add oCommandBar > > > > >
Message 10 of 13
Anonymous
in reply to: Anonymous

Replacing the line oEnvBase.PanelBarList.Add oCommandBar with oEnvBase.PanelBarList._Add oCommandBar should make it work. An underscore was added to the old Add method and hidden. Sanjay- "Neil Munro" wrote in message news:4182c14d_3@newsprd01... > Ok, I see this is from IV8. Is that the latest version you have on the > machine? The toolbar setup uses the IV8 methods whch are no longer > officially supported in IV9 (but should work). I have both 8 and 9 here and > there seems to be an issue with the line: > > oEnvBase.PanelBarList.Add oCommandBar > > oCommandBar is a CommandBarBase object and the .Add method wants a > CommandBar (should not be a problem but it fails with a Type Mismatch > error). I'm not sure if having both versions is causing the problem. > > If you customize the UI, does the toolbar show up in the list. It does for > me if I comment out the above line. You can them manually add it to the 2D > sketch environment. > > Anyone else have any ideas? > > Neil > >
Message 11 of 13
Anonymous
in reply to: Anonymous

Thanks Sanjay. Neil "Sanjay Ramaswamy (Autodesk)" wrote in message news:4182cb51$1_3@newsprd01... > Replacing the line > oEnvBase.PanelBarList.Add oCommandBar > with > oEnvBase.PanelBarList._Add oCommandBar > should make it work. An underscore was added to the old Add method and > hidden. > > Sanjay- > >
Message 12 of 13
Anonymous
in reply to: Anonymous

Samples seem hard to understand to the beginners. Do you have any simple (very simple) add-in I can start with Thanks. "Sanjay Ramaswamy (Autodesk)" wrote in message news:4182cb51$1_3@newsprd01... > Replacing the line > oEnvBase.PanelBarList.Add oCommandBar > with > oEnvBase.PanelBarList._Add oCommandBar > should make it work. An underscore was added to the old Add method and > hidden. > > Sanjay- > > "Neil Munro" wrote in message > news:4182c14d_3@newsprd01... > > Ok, I see this is from IV8. Is that the latest version you have on the > > machine? The toolbar setup uses the IV8 methods whch are no longer > > officially supported in IV9 (but should work). I have both 8 and 9 here > and > > there seems to be an issue with the line: > > > > oEnvBase.PanelBarList.Add oCommandBar > > > > oCommandBar is a CommandBarBase object and the .Add method wants a > > CommandBar (should not be a problem but it fails with a Type Mismatch > > error). I'm not sure if having both versions is causing the problem. > > > > If you customize the UI, does the toolbar show up in the list. It does for > > me if I comment out the above line. You can them manually add it to the 2D > > sketch environment. > > > > Anyone else have any ideas? > > > > Neil > > > > > >
Message 13 of 13
3DAli
in reply to: Anonymous

I have the same problem after upgrading to 2013 Pro. couldnt figure out how to fix it reading this post!

Signature_Small

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

Post to forums