.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selection

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
mooretlnl
789 Views, 4 Replies

Selection

Need a little help here.. I wrote this beautiful code only to find out that very last step, Autodesk has not allowed me a function is really need.

 

My work around is to “SendStringtoExecute”, yes I know….... Please don’t give me crap about it.  

 

My issue is that I need Autocad to select an item similar to a PromptEntity routine, but without the user actually selecting it.  For example, is there a way for an ObjectId to be passed into the selection. I would then run the SendStringtoExecute. I thought SetImpliedSelection would work, but I cannot get that to work, something about a one-dimensional array… will look into.

 

Troy Moore, PE

Civil 3d 2014

 

Tags (1)
4 REPLIES 4
Message 2 of 5
Jeff_M
in reply to: mooretlnl

Without seeing any code you are using, or what you are using it for...

ObjectId[] selectedIds = ObjectId[1];
selectedIds[0] = idofknownobject;
ed.SetImpliedSelection(selectedIds);

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 5
mooretlnl
in reply to: Jeff_M

Thanks for looking at....

 

'Network

Dim oStructureIds As ObjectIdCollection = Network.FindShortestNetworkPath(mystartstructureid, myendstructureid, 0)

 

'Add Pipes to profile view

For Each oid As ObjectId In oStructureIds

If oid.ObjectClass.DxfName = "AECC_STRUCTURE" Then

Dim oStructure As Autodesk.Civil.DatabaseServices.Structure = trans.GetObject(oid, OpenMode.ForWrite)

 

'PROBLEM HERE myEd.SetImpliedSelection(oid)

'TRY....STILL PROBLEM HERE myEd.SetImpliedSelection(oStructure.ObjectId)

 

' Add to structures profile view

myDocument.SendStringToExecute("AddNetworkPartsToProf S 100000.00000000,100000.00000000 101000.00000000,101000.00000000", True, False, False)

End If

Next

Message 4 of 5
Jeff_M
in reply to: mooretlnl

Both the Structure and Pipe objects have the AddToProfileview method, no need to invoke the command with SendStringToExecute...

 

Dim oStructureIds As ObjectIdCollection = Network.FindShortestNetworkPath(mystartstructureid, myendstructureid, 0)
 

'Add Pipes to profile view

For Each oid As ObjectId In oStructureIds

If oid.ObjectClass.DxfName = "AECC_STRUCTURE" Then

Dim oStructure As Autodesk.Civil.DatabaseServices.Structure = trans.GetObject(oid, OpenMode.ForWrite)

oStructure.AddToProfileView(oProfileViewId)

End If

Next

Also, there is a customization forum specifically for the Civil3D API's. You might find it useful to visit & post over there in the future.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 5
Anonymous
in reply to: Jeff_M

Sorry. I have been meaning to reply back to this. You are dead on with the fix. I somehow missed it. Thanks a bunch !

 

Troy.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report