How to get the Feature name of the following dimension

Valued Contributor
Valued Contributor

 

Hi jason,

 Please let me know  how to get the feature name for the given dimension. How to get it from the IDispatch pointe

      DimensionPtr pDim=Variable;

      _bstr_t DispName = pDim->GetDisplayName();

      IDispatchPtr pParentPtr = pDim->GetParent();

    //**** how to proceed next to get the Feature name

 

 

thanks

 

 

Posted by: Triad User
Post date: 5/11/2009 10:37:38 PM

4 REPLIES

RE: How to get the Feature name of the following dimension

Valued Contributor
Valued Contributor

Hi,

If the Dimension parent is a feature, you can always access to:

Internal name: property Name

PathFinder name: property DisplayName

 

I don't know about the C++ syntax, but hope this helps...

 

Posted by: Julian Guillo
Post date: 5/13/2009 5:20:37 AM

RE: How to get the Feature name of the following dimension

Valued Contributor
Valued Contributor

 

Hi Julian,

 Thanks for ypur reply... but i need to get all th information from the dimension pointer itself... I got dimension pointer from variable table...so we dont know whether its parent is a feature or not...

I got dispatch pointer of its parent...from this how to get the parent name....

thanks

 

 

Posted by: Triad User
Post date: 5/14/2009 6:17:07 PM

RE: How to get the Feature name of the following dimension

Valued Contributor
Valued Contributor

OK,

This is what i found. It's very limited indeed.

You can only get the feature object for a dimension (with GetRelated) when the dimension is placed in a profile (for example in an extruded protrusion)

Different cases you can find (for a extruded protrusion):

1- The feature was constructed calling the command, drawing a local profile in a ref plane, putting a dimension (we'll name it "A") in that profile , extruding a height "B" (the dimension is placed automatically by Solid Edge)

2- Construct a Sketch, and the feature was constructed from that Sketch, the sketch has got a dimension "A"

3- The feature was constructed calling the command, drawing a local profile just including lines in the previous sketch

 

You can only get the feature for case 1, if you look for it from dimension "A"

with GetRelated you obtain the line2d object, the parent for that line is a profile object, the parent for the profile is the ExtrudedProtrusion object.

You cannot obtain anything from dimension "B" (the automatic one) because GetRelated returns Nothing and Parent for a dimension is the Document object.

 

You can't obtain anything from case 2 because the dimension "A" parent is a profile inside a Sketch, but when you construct a extruded protrusion from a Sketch, the sketch profile is copied into the feature and not related with the sketch (programmatically) anymore.

 

Case 3 is more or less the same case as 2.

Well, not very good news...

 

 

 

Posted by: Julian Guillo
Post date: 5/15/2009 7:11:35 AM

RE: How to get the Feature name of the following dimension

Valued Contributor
Valued Contributor

Sorry,

I was not precise enough. It's even more difficult to get the feature in case 1 (the only possible)

From the dimension -> Getrelated -> you get a line2d object (for example) -> you get the parent Profile object

Now you have to iterate the Features collection looking for the feature.Profile property (it exists only in profile-based features) and compare with the profile found before.

 

If prof1 is prof2 then

you got it!

endif

 

Again, not good news.

Regards.

 

Posted by: Julian Guillo
Post date: 5/15/2009 7:21:45 AM