Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parallel planes, offset in cm but maximum in mm...?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
oransen
299 Views, 2 Replies

Parallel planes, offset in cm but maximum in mm...?

By experiment I think I've found out that when you constrain two planes with a Maximum value (so that they don't have to be co-planar but remain parallel) the offset must be in native Inventor units (cm), while the maximum must be in user units (in my case mm).

 

So are the comments in this code correct?

 

    CComVariant varOffset(kOffsetMm/10.0); // Convert to offset in cm
    CComPtr<FlushConstraint> pFlushConstraint ;   
    hRes = pConstraintList->AddFlushConstraint(pWPProxyA, pWPProxyB, varOffset,
                                               gkvarEmpty, gkvarEmpty,
                                               &pFlushConstraint);
    if (FAILED(hRes)) {
        ShowCOMError (hRes,L"AFCOTP AddFlushConstraint failed") ;
        return false ;
    }

    if (kmmMax > 0.0) {
        // This allows planes to be parallel constrained, but distant from each other
        // Even though the offset (above) is in cm, for parameters (below) it remains
        // in mm
        CComPtr<ConstraintLimits> pLimits =  pFlushConstraint->GetConstraintLimits() ;
        pLimits->MaximumEnabled = VARIANT_TRUE ;
        CString csMax ;
        csMax.Format (L"%.3f",kmmMax) ;
        CComBSTR TempBstr (csMax) ;
        pLimits->Maximum->Expression = TempBstr.m_str ;
    }

 

Is that correct?

 

 

 

 

 

Labels (3)
2 REPLIES 2
Message 2 of 3
Ralf_Krieg
in reply to: oransen

Hello

 

You set the maximum limit by using the Expression-property. This property is a string of value and unit which Inventor try to interpret. If no unit is found in string, Inventor takes the standard length unit of the document. To set maximum in database units (cm) use the Value-property.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 3
oransen
in reply to: Ralf_Krieg

Many thanks for that detailed clarification.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report