phibobaggins
New member
- Joined
- Jun 2, 2021
- Messages
- 1
- Programming Experience
- Beginner
Can someone please explain how you pass variables, in this case string or short from one class to another within the same name space?
i have a Draw_Line class and a Get_Line class. I want to get some data in the Get_Line class and pass it my Draw_Line class so i can draw an object with certain properties. I have no doubt this i user error but appreciate the help.
i have a Draw_Line class and a Get_Line class. I want to get some data in the Get_Line class and pass it my Draw_Line class so i can draw an object with certain properties. I have no doubt this i user error but appreciate the help.
C#:
namespace Drawing
{
public class Draw_Line
{
public void DrawLine()
{
Document dc = Application.DocumentManager.MdiActiveDocument;
Database db = dc.Database;
Editor ed = dc.Editor;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
try
{
// get the variables from ProPID_Get_Lines class
string layName = getLineLayer(LineLayer);
short layColor = getLineColor(LineColor);
string lineType = getLineLayer(LineLayer);
string lineFile = getLineFile(LineFile);
}
catch (System.Exception ex)
{
dc.Editor.WriteMessage("Error encountered...: " + ex.Message);
trans.Abort();
}
}
}
}
}
C#:
namespace Drawing
{
public class Get_Line
{
public string getLineLayer()
{
string LineLayer = "Process Major";
return LineLayer;
}
public string getLineType()
{
string LineType = "Phantom";
return LineType;
}
public string getLineFile()
{
string LineFile = "acad.lin";
return LineFile;
}
public short getLineColor()
{
short LineColor = 4;
return LineColor;
}
}
}
Last edited by a moderator: