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?
Solved! Go to Solution.
Solved by Ralf_Krieg. Go to Solution.
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.