Moving from autodesk entity to AECC extensions

Moving from autodesk entity to AECC extensions

Punisher
Archived Account
1,673 Views
12 Replies
Message 1 of 13

Moving from autodesk entity to AECC extensions

Punisher
Archived Account
Can anyone point me into a good direction for information regarding cogo point selection in Civil3D 2007, (and c#).

I can select the point entity, and get it into a cast Entity, and cast Object. I can get anything from the Civil point database as well, but how do I extract from the autocad selection entity, the AECC information to get that data from the AECC database?

Laurie,
I'll take it in VB.net (or whatever ya got). I might help me find the missing link.

Thanks for your time
0 Likes
1,674 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable
You don't use the normal AutoCAD/ActiveX GetEntity method to select points.
Use the SelectPoints method of the AeccDocument Object instead.

I posted a VBA solution for this back in July.


wrote in message news:[email protected]...
Can anyone point me into a good direction for information regarding cogo
point selection in Civil3D 2007, (and c#).

I can select the point entity, and get it into a cast Entity, and cast
Object. I can get anything from the Civil point database as well, but how
do I extract from the autocad selection entity, the AECC information to get
that data from the AECC database?

Laurie,
I'll take it in VB.net (or whatever ya got). I might help me find the
missing link.

Thanks for your time
0 Likes
Message 3 of 13

Punisher
Archived Account
thanks Jeff,
I found a post from a while back on "selecting Points"
I am trying to reverse the VB.net into C#. I see what you mean.
I am pretty close, but I need to investigate further the methods. Once I have selected an object, I'd like to be able to transfer the information internally, thus giving me more flexibility in software. However i suppose I could research a command method for select at a location, taking the location from the entity origin.
If you can assist further, please do. For now I will be trying to figure the specific language to accomplish what you described.
0 Likes
Message 4 of 13

Punisher
Archived Account
Jeff,
I messed with it, but haven;t quite got it. It seems as though the AECC Document.SelectPoints() keeps erroring out. I cast this thing as a AeccPoint, but I think I am not using the function properly.

I will keep trying, and review your code from July a bit more.
0 Likes
Message 5 of 13

Anonymous
Not applicable
it should return an array of point numbers, not points...

Cheers,

Peter Funk
Autodesk, Inc.
0 Likes
Message 6 of 13

Punisher
Archived Account
thanks,
I will give that shot. I'll post back with a result.
0 Likes
Message 7 of 13

Punisher
Archived Account
Thanks for all the assistance everyone. I am still having a bit of trouble. I have tried to port the VBA to C#, and apparently failed. I am missing something:

Autodesk.AECC.Interop.Land.AeccPoints cPoint = null;
Autodesk.AECC.Interop.Land.AeccPoint oPoint = null;
cPoint = (Autodesk.AECC.Interop.Land.AeccPoints)
m_oAeccDoc.Points;

int[] iaPointNum = (int[]) m_oAeccDoc.SelectPoints();
foreach (int iPn in iaPointNum)
{
oPoint = (Autodesk.AECC.Interop.Land.AeccPoint)
cPoint.Find(iPn);
oPoint.Layer = "C-PROP";
}

This bails as soon as you set cPoint, also bails if you call the iaPointNum first, either as an int[] or an object[].
Where did I go wrong, and what feeds the selectPoints() with a selection.
0 Likes
Message 8 of 13

Anonymous
Not applicable


Try the following code. The change is that it seems
like the object is really an array of integers and not of longs.


Regards,


Peter Funk
Autodesk, Inc.


[CommandMethod(
color=#800000>"PTX"
)]


public void
SelectPoint()


{


AutoCAD1.IAcadApplication m_oAcadApp =
color=#0000ff>null
;


AeccXUiLandLib.IAeccApplication m_oAeccApp =
color=#0000ff>null
;


AeccXUiLandLib.IAeccDocument m_oAeccDoc =
color=#0000ff>null
;


AeccXLandLib.IAeccDatabase m_oAeccDb =
color=#0000ff>null
;


//AeccXLandLib.IAeccSurfaces cSurfs = null;


string m_sAcadProdID =
color=#800000>"AutoCAD.Application"
;


string m_sAeccAppProgId =
color=#800000>"AeccXUiLand.AeccApplication"
;


try


{


m_oAcadApp = (AutoCAD1.
color=#008080>IAcadApplication
)System.Runtime.InteropServices.
color=#008080>Marshal
.GetActiveObject(m_sAcadProdID);


m_oAeccApp = (AeccXUiLandLib.
color=#008080>IAeccApplication
)m_oAcadApp.GetInterfaceObject(m_sAeccAppProgId);


m_oAeccDoc = (AeccXUiLandLib.
color=#008080>IAeccDocument
)m_oAeccApp.ActiveDocument;


// get the Database object via a late bind


m_oAeccDb = (AeccXLandLib.
color=#008080>IAeccDatabase
)m_oAeccDoc.GetType().GetProperty(
color=#800000>"Database"
).GetValue(m_oAeccDoc,
color=#0000ff>null
);


}


catch


{


}


AeccXLandLib.AeccPoints cPoints =
color=#0000ff>null
;


cPoints = m_oAeccDoc.Points;


Editor ed =
color=#008080>Application
.DocumentManager.MdiActiveDocument.Editor;


string msg = "\nPoints
"
+ cPoints.Count.ToString();


ed.WriteMessage(msg);


object objPoints;


objPoints = m_oAeccDoc.SelectPoints();


int[] xp = (
color=#0000ff>int
[])objPoints;


ed.WriteMessage(msg);


//int icount;


int icount = xp.GetLength(0);


ed.WriteMessage(icount.ToString());


for (int i = 0; i <
icount; i++)


{


msg = "\npoint " + xp.ToString();


ed.WriteMessage(msg);


}


}

0 Likes
Message 9 of 13

Punisher
Archived Account
Peter,
Thanks for all the assistance, I know a few others are following this thread as well.

This is still bailing, but I will try to take your code into a new project.

Autodesk.AECC.Interop.Land.AeccPoints cPoints = null;
cPoints = m_oAeccDoc.Points;

Error
No symbols are loaded for any call stack frame. The source code cannot be displayed.

I'll write back with the result
0 Likes
Message 10 of 13

Anonymous
Not applicable
Is the Aecc Doc object valid when you try to make the call? The code that I
sent was cut from a project that I was running this morning, so it should
work. I can post the whole thing if you need me to.

Peter
0 Likes
Message 11 of 13

Punisher
Archived Account
Thanks alot Peter, I got it going.
My database was apparently not available in the function, and I had to define it inside, as you had.

Next is off to get the Group list of points by select, and to bridge the gap between the point label, and the point.
It is impossible to see which marker is which when there are 10 within a foot of eachother. So I will pursue some code to bridge the gap so when we select the label we know we want, we get the marker we need.

more study

Thanks again for your assistance.
0 Likes
Message 12 of 13

Punisher
Archived Account
Peter,
any additional tips you might have would always be appreciated by the group.

Thanks again
John
0 Likes
Message 13 of 13

Anonymous
Not applicable
Good to hear!

FYI, you can make a point style that will scale relative to the screen size.
That might help the picking process.

Cheers,

Peter Funk
Autodesk, Inc.
0 Likes