Choosing among all the VBA reference

I am working with the version 8 Pro beta. I don't actually have VBA working in the program yet, but decided to continue to learn more VBA in Excel. When I decided to attept to create some graphics in BricsCAD using the Excel VBA, I came across this problem.When I attempt to add references to VBA, I am presented with a VERY long list of references. Many look to be AutoCAD or BricsCAD related, but I am uncertain what to do.Should I load all of the ones that look like possible CAD related references? Perhaps there is only one or two that I should use. I wonder if the BricsCAD ones are only for the older version. Here is the list of references that look like possibilities;AcAuthEntitiesl6ENU.tlb 1.0 Type Library AcAuthEntitiesl7ENU.tlb 1.0 Type Library AcDwgFilterlmp 1.0 Type Library AcFlelp 1.0 Type Library AcHelpDisplay 1.0 Type Library AcinetEngine 16,0 Type Library ACISUtils 1.0 Type Library AcPublish Type Library AutoCAD 2006 Type Library AutoCAD 2008 Type Library AutoCAD LT R4 Object Library AutoCAD Map MPolygon Type Library AutoCAD/ObjectD8x Common 1.0 Type Library AutoCAD/ObjectDBX Common 16.0 Type Library AutoCAD/ObjectDBx Common 17.0 Type Library Autodesk Actrix 1.0 Object Library Autodesk Actrix Catalog 1.0 Object Library Autodesk Volo View Control BricscadApp Type Library 2.3 BricscadDb Type Library 2.3 Joe Dunfee

Comments

  • Joe,just referencing the BricsCadApp Type Library in Excel VBA should do the trick.Here's a little code you could paste into a Module in the Excel VBA IDE.As you see it'll create 250 random circles in your drawing.Regards,Arno van EeuwenOption ExplicitPublic Sub Main() Dim MyDoc As BricscadApp.AcadDocument Dim MyCircle As IAcadCircle Dim dInsPnt(0 To 2) As Double Dim dRadius As Double Dim iColor As Integer Dim i As Integer Randomize Set MyDoc = BricscadApp.ActiveDocument For i = 1 To 250 dInsPnt(0) = Rnd * 100 - 50 dInsPnt(1) = Rnd * 100 - 50 dInsPnt(2) = 0 dRadius = Rnd * 50 iColor = Int(Rnd * 255 + 0.5) Set MyCircle = MyDoc.ModelSpace.AddCircle(dInsPnt, dRadius) MyCircle.Color = iColor MyCircle.Update Next MsgBox "Ready boss" EndEnd Sub

  • I was wondering if you might be able to show the same example coded for VB.NET Express. The example you have given runs fine in VBA but when brought over to VB.NET there seems to be problems making a connection. Also says that ActiveDocument is not a member of Bricscadapp, which seems to be the case in VB.NET object browser. (Bricscadapp.acadapplication.activedocument)I'm not much of a programmer but I have written an automation program in VB Express to act as a front end for Multiframe software and thought I had it somewhat figured out.Anyway, would appreciate your efforts.

  • Jerry,I have had a little play with C# in .NET , connecting to Bricscad. I'm not yet as comfortable with it as I'm with VB(A), but have a look at the subject of Marshaling in .NET. It's described as 'the bridge'between .NET and a COM interface.Also:Some ducumentation I bought on C# shows following example for linking to Excel from .NET:Excel.Application objExcel = new Excel.Application; //<< starts ExcelobjExcel.Visible=true; //<< makes it visibleAs you can see, no Marshaling is used here.I can't yet explain the difference, hope this gets you on your way anyway.Arno van Eeuwen

  • Jerry,Here's a small C# example which makes a connection and creates a circle in V8. VB.Net should do something similar.Regards,Arnoprivate void cmdCircles_Click(object sender, EventArgs e) { BricscadApp.AcadApplication BricSysV8; BricscadDb.AcadCircle NewCircle; double[] dInsPnt; double dRadius=5; dInsPnt = new double[3]; dInsPnt[0]=50; dInsPnt[1]=25; dInsPnt[2]=0; BricSysV8 = (BricscadApp.AcadApplication)Marshal.GetActiveObject("BricscadApp.AcadApplication"); NewCircle = BricSysV8.ActiveDocument.ModelSpace.AddCircle(dInsPnt, dRadius); NewCircle.Update(); }

This discussion has been closed.