walkinside / sdk

Develop powerful desktop and web applications on top of Walkinside 3D engine
4 stars 4 forks source link

Branch Select is not working #45

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi,

I can retrieve list of branch using below code,

var branches = SDKViewer.ProjectManager.CurrentProject.BranchManager.GetBranchesByNameFragmentAndKind("branchName", VRBranchKind.Cad);
            MessageBox.Show(branches.Count().ToString());

Output, image

But i couldn't select the defined branch in CAD hierachy with below,

var branches = SDKViewer.ProjectManager.CurrentProject.BranchManager.GetBranchesByNameFragmentAndKind(Input, VRBranchKind.Cad);
            foreach (IVRBranch branch in branches)
            {
                branch.Select();
            }

Error, image

Could anyone please tell how to select the branch?

Thanks,

dkOogway commented 6 years ago

It will work with, branch.Select(1);

But this is obsolete now.

kveretennicov commented 6 years ago

First of all, is there some reason why you call branch.Select() in a loop? You will not see intermediate results anyway - all you will see is the last branch selected.

Anyway, I tried to reproduce the issue you report using SDK package from https://github.com/walkinside/sdk/releases/tag/from-10.2.35. I used Example 3 and added the following lines to the form's constructor:

var branches = SDKViewer.ProjectManager.CurrentProject.BranchManager
    .GetBranchesByNameFragmentAndKind("BASE_SLAB", VRBranchKind.Cad);
foreach (IVRBranch branch in branches)
{
    branch.Select();
}

I ran it on example Stabilizer project from the Walkinside package. There were no errors.

I suspect some important details are missing from your report, like the fact that you use threads or background workers.

Could you take "Example 3" and modify it until you reproduce the issue in example Stabilizer project, then share those changes with us?

dkOogway commented 6 years ago

Reason behind of calling branch.Select() in loop is, defined or required value to be searched. Not to get list of values.

Is different from version to version? am using COMOS Walkinside 10.2.34.46.

Will check with Example 3 as suggested and update.

kveretennicov commented 6 years ago

Thank you. Once we have the complete minimal code and data to trigger this error, we can debug the issue much faster.

dkOogway commented 6 years ago

Good to hear, :)

Any other way to select branch. Please suggest. Thanks

gcorvala commented 6 years ago

Hi @dkOogway, another way that might be good for your use case is using IVRGroupExtensions.Highlight() helper. This will apply style and color to a group of branches but won't trigger selection events. We are closing the issue but feel free to reopen it if it doesn't fit your needs.