I really can't tell you much from the snippets you posted.
The only thing I can tell you is that you might be better off
passing the entire array of ObjectIds to acedCmd() because
of the amount of work that SelectionSet.FromObjectIds()
must do.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6262296@discussion.autodesk.com...
This all started when I needed to pass a collection of ObjectIDs to acedCmd
{code}Declare Auto Function acedCmd Lib "acad.exe" Alias "acedCmd" (ByVal
resbuf As IntPtr) As Integer{code}
The approach I used was to create a selection set out of the ObjectIds, and
pass it as part of the result buffer required by acedCmd. I've tried using
Autodesk.AutoCAD.Runtime.LispDataType.SelectionSet (5007) for the data type.
{code}Dim ss As Autodesk.AutoCAD.EditorInput.SelectionSet =
Autodesk.AutoCAD.EditorInput.SelectionSet.FromObjectIds(SourceIds.ToArray())
ExecuteCommand("_.pedit", "m", ss, "", "", "j", "", "")
{code}
As you can see, it should simply make an attempt to join all of the objects
into a polyline.
The code appears to work fine, but I've noticed two things:
1. Using reflection on the SelectionSet returns
"SelectionSetFullyMarshalled" instead of the expected "SelectionSet" Type
Name.
2. Running my application works, but if run multiple times I eventually I
get a TargetInvocationException from the Add() method of AcDb.ResultBuffer
I guess what I am asking here is if I have created my ResultBuffer correctly
by using LispDataType.SelectionSet or if it's more likely that I am just not
disposing my objects correctly elsewhere in my application.
{code}Return New
AcDb2.TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.SelectionSet,
DirectCast(source, Autodesk.AutoCAD.EditorInput.SelectionSet)){code}
Regards,
JB