×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Get all dimension parameter from assembly

Get all dimension parameter from assembly

Get all dimension parameter from assembly

(OP)
Hi!

I have a big problem. I like get the all dimension parameter of my assembly. (API)
I don't know the name of parameter, therefore I like get the all parameters, and I check the read-only flag of dimension (and set to false, if not...)

I not found any method that read up the parameters of assembly (without name of parameter).

Have you any idea?

Thanks,
ZsZs.

RE: Get all dimension parameter from assembly

(OP)
I did a Pack'NGo with API functions. (C++ COM technique)
I have some bad equation (and many good too).
I like to change the bad equation to the good. It is very simple.

I attach a picture. The dimension in the purple ellipse are read-only.
My job remove the read-only flag in the assembly.
This parameter in the part isn't read-only.

Before I upgrade the equations, I need to remove the read-only flag from assembly.
The main problem, that the equation refering the part, but it is correct (not read-only).
The dimension of assembly, above one level of part, is read-only.

And I don't know the name of assembly! (I need find without filename.)
I see one possibility: read all dimension of all assembly, and if found some read-only dimension, I remove this flag.
Accordingly, I need a method, that I get the all dimension parameter of a assembly.

I wrote a small program:

IFeature *Feat = NULL, *FeatNext = NULL;
swDoc->IFirstFeature (&Feat);
while(Feat)
{
    CComBSTR bName("");
    Feat->get_Name(&bName);
    string FeatName = UTIL::BSTR2str(bName);

    CComBSTR bType("");
    Feat->GetTypeName2(&bType);
    string FeatType = UTIL::BSTR2str(bType);

    cout<< "Feature - Name: " << FeatName << " Type: " << FeatType << endl;

    IDispatch *Disp = NULL, *DispNext = NULL;
    Feat->GetFirstDisplayDimension(&Disp);

    while(Disp != NULL)
    {
        IDisplayDimension* swDispDim = NULL;
        Disp->QueryInterface(IID_IDisplayDimension,(void**) &swDispDim);

        IDimension* swDim = NULL;
        swDispDim->GetDimension2(0, &swDim);
        if(swDim != NULL)
        {
            CComBSTR bDimFullName("");
            swDim->get_FullName(&bDimFullName);
            string DimFullName = UTIL::BSTR2str(bDimFullName);

            unsigned short int* x = 0;
            double retval = -1;
            swDim->IGetSystemValue3(swSetValue_InThisConfiguration, 0, &x, &retval);
            string DimValue = UTIL::d2s(retval);

            cout << "\tDimension: " + DimFullName + " = " + DimValue << endl;
        }

        Feat->GetNextDisplayDimension(Disp, &DispNext);
        Disp = DispNext;
    }

    Feat->IGetNextFeature (&FeatNext);
    Feat = FeatNext;
}

This is working correctly by the parts.
The results:

Feature - Name: Design Binder Type: DocsFolder
Feature - Name: Annotations Type: DetailCabinet
Feature - Name: Lights, Cameras and Scene Type: EnvFolder
Feature - Name: Solid Bodies Type: SolidBodyFolder
Feature - Name: Surface Bodies Type: SurfaceBodyFolder
Feature - Name: Comments Type: CommentsFolder
Feature - Name: Glass Type: MaterialFolder
Feature - Name: Front Plane Type: RefPlane
Feature - Name: Top Plane Type: RefPlane
Feature - Name: Right Plane Type: RefPlane
Feature - Name: Origin Type: OriginProfileFeature
Feature - Name: Sketch1 Type: ProfileFeature
        Dimension: D1@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.69633
        Dimension: D2@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.54448
        Dimension: D3@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.21915
        Dimension: D4@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.48626
        Dimension: D5@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.73
Feature - Name: Extrude-Thin1 Type: ExtruThin
        Dimension: D1@Extrude-Thin1@UhK05_JUNS02-2_Mb26_002.Part = 0.926
        Dimension: D5@Extrude-Thin1@UhK05_JUNS02-2_Mb26_002.Part = 0.005
        Dimension: D1@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.69633
        Dimension: D2@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.54448
        Dimension: D3@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.21915
        Dimension: D4@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.48626
        Dimension: D5@Sketch1@UhK05_JUNS02-2_Mb26_002.Part = 0.73
Feature - Name: Chamfer1 Type: Chamfer
        Dimension: D1@Chamfer1@UhK05_JUNS02-2_Mb26_002.Part = 0.001
        Dimension: D2@Chamfer1@UhK05_JUNS02-2_Mb26_002.Part = 0.785398
Feature - Name: Chamfer2 Type: Chamfer
        Dimension: D1@Chamfer2@UhK05_JUNS02-2_Mb26_002.Part = 0.001
        Dimension: D2@Chamfer2@UhK05_JUNS02-2_Mb26_002.Part = 0.785398

BUT if I scanning a assembly, not found the dimensions:
The result:

Feature - Name: Design Binder Type: DocsFolder
Feature - Name: Annotations Type: DetailCabinet
Feature - Name: Lights, Cameras and Scene Type: EnvFolder
Feature - Name: Comments Type: CommentsFolder
Feature - Name: Equations Type: EqnFolder
Feature - Name: Front Plane Type: RefPlane
Feature - Name: Top Plane Type: RefPlane
Feature - Name: Right Plane Type: RefPlane
Feature - Name: Origin Type: OriginProfileFeature
Feature - Name: Fns1_JUNS02-2_Mb26_1_002-1 Type: Reference
Feature - Name: Fp01_JUNS02-2_Mb26_1_002-1 Type: Reference
Feature - Name: SeK06_JUNS02-2_Mb26_002-3 Type: Reference
Feature - Name: SeK06_JUNS02-2_Mb26_002-2 Type: Reference
Feature - Name: UhK05_JUNS02-2_Mb26_002-1 Type: Reference
Feature - Name: Mates Type: MateGroup

I how access, the dimension parameter in assembly file?

Thanks,
ZsZs.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources