Problem getting the Distance property in a DistanceChamfer via API

Problem getting the Distance property in a DistanceChamfer via API

Anonymous
Not applicable
304 Views
1 Reply
Message 1 of 2

Problem getting the Distance property in a DistanceChamfer via API

Anonymous
Not applicable

Hi there,

I am using Inventor 2018 and programming an addin in C++. I would like to access the 'Distance' property in a DistanceChamferDefPtr object but I am getting a _com_error exception.

 Snippet

ChamferFeaturePtr chamferFeature = chamferColl->GetItem(itChamfer);
if (chamferFeature == NULL)
    return;
 
ChamferDefinitionPtr chamferDef = chamferFeature->GetDefinition();
if (chamferDef->Type == kDistanceChamferDefObject) {
    DistanceChamferDefPtr distanceChamfer = chamferDef;
    if (distanceChamfer) {
        ParameterPtr distanceParam = distanceChamfer->Distance;
        double value1 = (double)distanceParam->Value;
 
        VARIANT_BOOL setBack = VARIANT_FALSE;
        setBack = distanceChamfer->CornerSetback;
        double angle = 45.000;
    }
} 

When I try to get the Distance or CornerSetback ParameterPtr is when the program raises the exception. Any clue where my problem could be located?

 

Regards

0 Likes
Accepted solutions (1)
305 Views
1 Reply
Reply (1)
Message 2 of 2

Mark.Lancaster
Consultant
Consultant
Accepted solution

@Anonymous

 

Welcome to the Autodesk User's Community..

 

Although someone may come along and assist you..  Programming questions and needs should be asked in the Inventor Customization forum.  I will have the moderator relocate it there to better suit your needs.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes