Help regarding full explode.

Help regarding full explode.

Anonymous
Not applicable
1,259 Views
1 Reply
Message 1 of 2

Help regarding full explode.

Anonymous
Not applicable

Hello  Forum,
I am exploding .dwg file in revit .
my code is working for partial Explode but it is not working for Full Explode.
Below is sample code:
Working:

public void PressDWGExplodeButton()
{

try
{
AutomationElement mainWndFromHandle = AutomationElement.FromHandle(m_application.MainWindowHandle);
//AutomationElement mainWndFromHandle = AutomationElement.FromHandle(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);

PropertyCondition nameRibbonCondition
= new PropertyCondition(
AutomationElement.NameProperty,
"Explode");

PropertyCondition typeRibbonCondition
= new PropertyCondition(
AutomationElement.ControlTypeProperty,
ControlType.Custom);

AndCondition andCondition
= new AndCondition(
typeRibbonCondition,
nameRibbonCondition);

var ribbonWnd = mainWndFromHandle.FindFirst(
TreeScope.Descendants, andCondition);


var a3 = mainWndFromHandle.FindAll(TreeScope.Descendants, andCondition);

PropertyCondition aIDCondition
= new PropertyCondition(
AutomationElement.AutomationIdProperty,
"Dialog_Essentials_ImportInstanceExplode:Control_Essentials_ImportPartialExplode_RibbonListButton_FlyoutButtonExecute");


var fullExplodeButton = ribbonWnd.FindFirst(TreeScope.Children, aIDCondition);


InvokePattern invPattern = fullExplodeButton.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;

invPattern.Invoke();
Class2.exploded = true;

}
catch (Exception ex)
{

}

}
Journal file :

partial explode:

Jrn.PushButton "ToolBar , {}{} , Dialog_Essentials_ImportInstanceExplode" _
, "Partial Explode, Control_Essentials_ImportPartialExplode"

Full Explode:
Jrn.PushButton "ToolBar , {}{} , Dialog_Essentials_ImportInstanceExplode" _
, "Full Explode, Control_Essentials_ImportExplode"

I have changed condition and  I am  getting fullExplodeButton null;

PropertyCondition aIDCondition
= new PropertyCondition(
AutomationElement.AutomationIdProperty,
"Dialog_Essentials_ImportInstanceExplode:Control_Essentials_ImportExplode_RibbonListButton_FlyoutButtonExecute");

0 Likes
1,260 Views
1 Reply
Reply (1)
Message 2 of 2

franjavigarciavalencia
Enthusiast
Enthusiast

Hi, did you find any success with the full explode?

Also, I am trying your solution for the partial explode and I am finding a problem in which the ribbonWnd is null (I start from an imported CAD in the current view):

franjavigarciavalencia_0-1729585870093.png

Could you provide a bit more context about your solution?

Thanks and regards.

0 Likes