How do I pass a .lsp argument to my C# Addon command?

How do I pass a .lsp argument to my C# Addon command?

Chris_GILMERRTXWM
Contributor Contributor
211 Views
1 Reply
Message 1 of 2

How do I pass a .lsp argument to my C# Addon command?

Chris_GILMERRTXWM
Contributor
Contributor

I am patching together a combination of .lsp and C# for an Advance Steel Addon.  I'm including the .lsp front end only because I already have the user defined functions and a working copy of code to read the contents of an Excel file.  I want to pass the contents of a single cell that is returned by the .lsp to the C# portion of this 'combo-Addon'.  The purpose is to have a document that is easy to edit [Excel] that pairs EU steel shapes with US steel shapes and covert/draw between the two.

Chris_GILMERRTXWM_2-1729808128870.png

Chris_GILMERRTXWM_3-1729808183854.png

 

My C# code for now is expecting a string from .lsp as an argument and displaying that with MessageBox.Show.  My C# code for doing this is:

 

 

using System;
using System.Collections.Generic;
using Autodesk.AdvanceSteel.CADAccess;
using Autodesk.AdvanceSteel.DocumentManagement;
using Autodesk.AdvanceSteel.Runtime;
using System.Windows.Forms;

namespace OE_DrawSteel
{
    public class EUtoUS
    {
        [CommandMethodAttribute("DRAWSTEEL_GROUP", "_DrawSteel", "_DrawSteel", CommandFlags.Modal)]
        public void DrawSteel( string shape )
        {
            MessageBox.Show(shape);
        }
    }
}

 

 

 Everything builds without error.

Chris_GILMERRTXWM_0-1729806912588.png

I can successfully load the .dll file with [Command: ASTORLOADASNETPLUGIN].
And I have a DRAWSTEEL command in AS.

Chris_GILMERRTXWM_1-1729807157115.png

How do I call this with the argument that I am trying to display with MessageBox.Show?
I have tried all kinds of combinations on the AS command line with what I have.

Do I need to define 

 

 

public void DrawSteel( string shape )

 

 

as something different than a void type with a string argument?

The ultimate goal is to:
-- pull string values from Excel and make lists of lists of lists with .lsp
-- feed that into a .lsp dialog popup_list to make selection of EU steel shape and convert to US shape
-- using .lsp, call the C# Addon with the string argument of the US shape
-- draw the US shape in Advance steel

Any ideas?
Should I ditch the .lsp and rewrite the Excel harvest in C# to eliminate the need to pass a variable?

Thanks to all that read this far,
Chris

0 Likes
212 Views
1 Reply
Reply (1)
Message 2 of 2

Chris_GILMERRTXWM
Contributor
Contributor

I have removed the need for an argument and am trying to utilize a message box with a hard coded string as the message instead of the value of a variable.


Everything same as before except:

MessageBox.Show("Test");

Builds without error.  Command is valid.  Yet no message box appears.  I believe I have all the references that allow this to happen.

What am I missing?
thanks - Chris 

0 Likes