Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change Workbech ?

Status
Not open for further replies.

Talou

Computer
May 14, 2019
17
0
0
SE
Hello,

New question, new thread...

I want to launch the command "Delete Useless Elements" which is in the "Part Design" workbench.
In the following pic. We can see that the user selected the Document. However, the active object is a product. Therefore we are on the "Assembly" workbench.

simpleAssembly_uvfr04.png


Question: How can I change the workbench to "Part Design" ?

I tried CATIA.StartWorkbench("PrtCfg") which create a new part and switch the ActiveDocument to that new part.

Thank you,

Talou;
 
Replies continue below

Recommended for you

this is what I do...
Set objPart1 = documents1.item(selection1.item(1).value.ReferenceProduct.Parent.name)

selection1.Clear
selection1.Add objPart1.Part
CATIA.StartWorkbench ("PrtCfg")
selection1.Clear

regards,
LWolf
 
Thank you LWolf!

Why do I suck so much at this!

I tried to feed the selection1.Add with PartDocument, ProductDocument, Document... Nothing was working.

When I'm reading the doc; I'm still confuse between CATIAPartDocument (which I guess it the .Part) and PartDocument which is something else.

Here is my code now:

C#:
Selection pSel = CATIA.ActiveDocument.Selection;
Product pProd = pSel.Item2(1).Value as Product;
CATBaseDispatch pObj = pProd.ReferenceProduct.Parent;
PartDocument pPart = pObj as PartDocument;
pSel.Clear();
pSel.Add(pPart.Part); // <-- The missing link...

CATIA.StartWorkbench("PrtCfg");

Tks again!

Talou;
 
Status
Not open for further replies.
Back
Top