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!

Get all dimension parameter from assembly

Status
Not open for further replies.

ZsZs

Computer
May 8, 2007
30
0
0
HU
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.
 
Replies continue below

Recommended for you

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.
 
 http://files.engineering.com/getfile.aspx?folder=b7c26b7e-0775-444b-8859-68f50e24c878&file=fig1b.jpg
Status
Not open for further replies.
Back
Top