DefineFunction

According to the help file, this function will add a macro to the Bricscad command list. I have not been able to make this work.Consider the code below:Public Sub DefineTest() Call IntelliCAD.definefunction("C:TEST", AcadEnum.TestingDefineFunction)End SubPublic Function TestingDefineFunction() MsgBox "TEST"End FunctionRunning the "DefineTest" sub runs the "TestingDefineFunction". Typing "TEST" on the command line afterwards will NOT run "TestingDefineFunction".The help on this is somewhat non-existant and I'm tired of fooling around with this. Can someone please tell me what I'm doing wrong here?Thanks in advance.

Comments

  • Running VAB macros from LISP is crucial if I'm to port our application from AutoCAD to Bricscad, so I really need this to work.The following change to "TestingDefineFunction" makes Bricscad crash every time:Public Function TestingDefineFunction() As String MsgBox "TEST"End FunctionIf this function (DefineFunction) just does not work, is there another way to call VBA macros from LISP other than (command "-vbarun" "macroname")?

  • Have the same question. As I understand syntax is definefunction("cmd_name", Ptr to Func). I guess I don't understand the pointer part. Seems like it would be something like module1.test, being the macro name?Can't seem to get it to work,--however, I've been trying to use the lisp method and can't get that to work. May have something to do with the fact I'm putting the macro in CommonProjects.vbi?Anyway, found that turning affinity to single cpu really makes a difference. With a short DO loop have a macro that wont run while hyperthread enabled. Pops out of the DO Loop after one iteration. Can single step through ok. Turn affinity to a single cpu and the macro runs fine. You guys might take a look if that type of conditional looping is where the crashes come from..such ++ may run amuck.Just some thoughts. Thanks in advance for any tutoring you may be able to provide.

  • The .DefineFunction Call IntelliCAD.DefineFunction("c:TEST", AddressOf Module1.TestingDefineFunction) will only work in an add-in .dll VB project. With VBA you cannot create .dll or .exe projects. If you want to create such add-in projects you will need to use VB 6.0. With VBA you can only reach the macro's defined the BricsCad's VBA environment. However you state: "Running VBA macros from LISP is crucial if I'm to port our application from AutoCAD to Bricscad, so I really need this to work.". From this I understand that you wish to launch a VBA macro from a lisp application. In that case I would use (command "-vbarun" "commonprojects.module1.hello") in your lisp application to launch a Sub called 'hello' and which is located in the VBA project 'CommonProjects.Module1' Sub hello() MsgBox "hello world" End Sub Hope this helps, Ferdinand Janssens

  • Thanks, Ferdinand. Part of our porting process will be to extract modules, classes and possibly forms out of the VBA project and into a VB .dll project. I'll have a go at making DefineFunction work within one of the DLL's.Rune

  • I need more help on this, as I'm unable to make anything work except crashing Bricscad every single time I try.I create a DLL project in VB. This project has a module and a class. The module has this function:Public Function Test() As String Test = "TESTING"End FunctionThe class has this sub:Public Sub DefunTest() Call intellicad.Application.DefineFunction("C:TEST", AddressOf Test)End SubI build the DLL and reference it in my VBA project.In the VBA project I create a public sub that creates an instance of the class mentioned above and run the "DefunTest" sub, then I run the sub. This works. If i type "!C:Test" in the command line in bricscad, "Ext. Subr: -1 #00AB3594" is returned, which tells me that the function has been defined.Then I type "Test" and press enter. Bricscad closes down immediately without a sound, it's just gone. This happends every single time. I have tried numerous variations on this with the same result.I have depledted my own and my co-workers resources trying to figure this out. Please help me make this work (if it does).

  • Hello Rune,I'll contact you directly concerning development support for this issueHans

This discussion has been closed.