Jump to content

Transfer ObjectId[] idArray between methods in class


muck

Recommended Posts

How can idArray passed made to be used in another method or event in the same class after the above

code is ran?

 

placing "public static ObjectId[] idArray;" in the form general area does not work

 

Code is given below:

[CommandMethod("PICKFIRST1")]

public void Pickfirst1()

{

Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

Database db = HostApplicationServices.WorkingDatabase;

Transaction tr = db.TransactionManager.StartTransaction();

try

{

 

TypedValue[] filList = new TypedValue[1] {new TypedValue((int)DxfCode.Start, "INSERT")

};

SelectionFilter filter = new SelectionFilter(filList);

PromptSelectionOptions opts = new PromptSelectionOptions();

opts.MessageForAdding = "Select block references: ";

PromptSelectionResult res = ed.GetSelection(opts, filter);

 

SelectionSet selSet = res.Value;

// How can idArayy be made shared in another method?

ObjectId[] public static ObjectId[] idArray; = selSet.GetObjectIds();

 

tr.Commit();

}

catch (Autodesk.AutoCAD.Runtime.Exception ex)

{

ed.WriteMessage(("Exception: " + ex.Message));

}

finally

{

tr.Dispose();

}

}

 

Thank you,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...