Hi
Is a LISPFunction (LISP callable wrapper) still the acknowledged mechanism to pass arguments to a .NET plugin?
Leading on from this, if the answer is yes, how do I build an OEM application so that the same mechanism will work? Currently I get LISP command is not available when I run it. (I'm actually running from a tool palette command (MYCOMMAND "myarg"). There are no LISP scripts or code beyond the call.
Thanks in advance.
Craig
In AutoCAD OEM I had to implement an AutoLISP module that calls the LispFunction. The downside is the functions exposed in the lisp module (defun C:xxx) can't pass arguments.
Any suggestions how I can pass arguments to my command(s)?
The reason I would like to do this is I want to have a set of tool palette items each with a different image and setting that is passed to a single command.
Hello Craig,
Can you please provide a broader picture of what you are trying with the tool palettes in AutoCAD OEM ?
Sorry, I do not understand what you mean by "have a set of tool palette items each with a different image and setting that is passed to a single command."
If you can please provide more information, I can try it in AutoCAD OEM and let you know if there is a way to do that.
Thanks
Regards,
Balaji
Hello Balaji,
We want the convenience of a tool palette to be able to insert blocks. We have many custom blocks, the number of which will change over time. We want to pre-process and post-process the insert but I have determined I cannot use events so I will use a dedicated command.
Currently, I have a command for each block, which is inflexible. I would like to have a single command and pass the block name. This will allow us to change the number of blocks supported without the need to rebuild our OEM product.
Neither .NET command or LISP commands accept arguments. LISP route was investigated but eliminated. We would like to do this in .NET.
Regards
Craig
Hello Craig,
Thanks for clarifying.
If a .Net command uses the "Editor.GetString" to request for the block name, you can provide that while invoking the command as
(command "MyInsertCommand" "Bolt").
[CommandMethod("MyInsertCommand")] public void MyMethod() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; PromptStringOptions pso = new PromptStringOptions("\nBlock name to insert : "); pso.AllowSpaces = true; PromptResult pr = ed.GetString(pso); if (pr.Status != PromptStatus.OK) return; String blockName = pr.StringResult; ed.WriteMessage(String.Format("{0}Block name inside .Net command : {1}", Environment.NewLine, blockName)); }
Will this work in your case ?
Regards,
Balaji
Hi Balaji,
Not in this case. We don't want the user to be able to input the name or be given the opportunity to change it.
This is what I was hoping for ...
Regards,
Craig
Hello Craig,
Please try the following command string in the tool properties :
^C^C_MyInsertCommand;Bolt;
This should provide the "Bolt" text as the input for the .Net command.
Regards,
Balaji
Hi Balaji,
Sorry, I don't understand how _MyInsertCommand can process "Bolt".
Can you explain what you would expect _MyInsertCommand should do?
Thanks
Craig
Hello Craig,
I think we are not on the same page yet 🙂
This is my understanding so far -
There is a single .Net command to which you need the block name to be provided as an input.
This .Net command can pre-process, insert and post process after the block is inserted.
The .Net command is to be invoked from the Tool palette
Is there anything that I missed ?
In the code snippet, "MyInsertCommand" represents a .Net command that inserts the block and the command string provides the block name as the input to the command.
Regards,
Balaji
Standard menu macro process, same as with any other AutoCAD command which requests input from the user. Try it with other commands, like "-Layer;make;foo;" to see how it works.
Ok I've just attended the macro guide to dummies course
This will give us the flexibility we need .
Thank you for your help
Craig