Community
Topobase (Read Only)
Welcome to Autodesk’s Topobase Forums. Share your knowledge, ask questions, and explore popular Topobase topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ribbon Button Command does not Highlight on Map

3 REPLIES 3
Reply
Message 1 of 4
HyVong
799 Views, 3 Replies

Ribbon Button Command does not Highlight on Map

Hello,
I have created a Ribbon button through the API.
I created a Command so that when the user clicks on this button, it captures the selected feature from map and performs a trace, and highlight the result on the map.

My Command...
[CommandMethod("TRACEDOWN ", CommandFlags.UsePickSet)]
...
Document.Map.HighlightFeatures(features, Topobase.Map.MapLogic.HighlightModes.Highlight, true);
...

My trace result returns data but it does not highlights. I only have one document in my workspace.

I used [CommandMethod("HIGHLIGHTTEST", CommandFlags.Session)] then the highlights works but i want to know what was being selected.

How do i achieve this using the CommandMethod()?

When the user clicks on my Ribbon Button, all i want to do are:
- determine which feature was selected
- Trace up or down from the selected feature and get the result
- Highlight the result on Map

Thanks in advance for all the hellp.


HyVong

Edited by: HyVong on Jul 27, 2009 8:55 PM Edited by: HyVong on Jul 27, 2009 8:56 PM
3 REPLIES 3
Message 2 of 4
Dev475
in reply to: HyVong

Hi HyVong,

This a late post, but you should be able to do what you're looking for by using both flags at once.

For example:


[CommandMethod("TRACEDOWN ", CommandFlags.UsePickSet | CommandFlags.Session)]
Message 3 of 4
HyVong
in reply to: HyVong

I found the solution, i'll post it here for those who want to achieve this functionality.
The key word is highlighted in bold (CommandFlags.Session)

[CommandMethod("TRACEDOWN", CommandFlags.UsePickSet | CommandFlags.Session)]
public static void TraceDownstream()
{
Topobase.Forms.Application TBApplication = Topobase.Forms.Application.Instance;
List IDs = new List();
Editor ACADEditor;
PromptSelectionResult SelectionResult;

// Get item(s) selected from map
ACADEditor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
SelectionResult = ACADEditor.SelectImplied();

switch (SelectionResult.Status)
{
case PromptStatus.OK:
IDs = RetrieveSelectionIDs(SelectionResult.Value); // i have attached the code for this method
break;
case PromptStatus.Cancel:
case PromptStatus.Error:
default:
break;
}

Int64 SelectedFeatureFID = Convert.ToInt64(IDs[0]);

...................now that you got the selected feature, do your trace or what ever

To Highlight the features on the map, you may have to convert your feature(s) into FeatureLists or long[] fids
YourDocument.Map.HighlightFeatures(FeatureList, Topobase.Map.MapLogic.HighlightModes.Highlight, true);
To Unhighlight
YourDocument.Map.UnhighlightFeatures();

Hope this helps!
Message 4 of 4
elias.m.khoury
in reply to: HyVong

Hi HyVong,

Have you ever tried to retrieve the IDs from the ObjectID?
In my case, I don't have access to the SelectionSet, I only have a list of ObjectIDs (I realised that their entities are of type BulkEntity).
So I need to get their SubObjects, which I couldn't do with entity.GetSubentities() because I don't have them in a SelectionSet.
An approach that I tried:

SelectedObject so = new SelectedObject(objectId, SelectionMethod.SubEntity, 0);

SelectedSubObject [] sbo = so.GetSubentities();

In this case, "so" is being created successfully, but "sbo" is always null.


I hope you can help,

Thank you,

Elias

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

Post to forums  

Autodesk Design & Make Report