458 #include <unordered_map> 459 #include <functional> 465 #pragma warning(push) 466 #pragma warning(disable : 4503) 494 _failureCallback = failure_cb;
499 std::string
const &
file(
void )
const {
505 int const &
line(
void )
const {
511 std::string
const &
fn(
void )
const {
530 if( _result != A3D_SUCCESS && _failureCallback ) {
531 return _failureCallback(*
this);
533 return A3D_SUCCESS == _result;
543 A3DStatus _result = A3D_SUCCESS;
544 std::function<bool(CheckResult const&)> _failureCallback = [](
ts3d::CheckResult const &r ) {
545 std::string
const error_string = A3DMiscGetErrorMsg( r.result() );
546 std::cerr <<
"API FAILURE: " << r.fn() <<
" [" << r.file() <<
":" << r.line() <<
"] == " << error_string <<
"(" << r.result() <<
")" << std::endl;
558 #define CheckResult( f ) \ 559 ts3d::CheckResult::instance()._record( __FILE__, __LINE__, #f, f ) 570 #define A3D_HELPERS( A3D_VOID_TYPE ) \ 575 struct A3D_VOID_TYPE ## Wrapper { \ 578 using DataType = A3D_VOID_TYPE ## Data; \ 582 A3D_VOID_TYPE ## Wrapper( A3D_VOID_TYPE *ntt = nullptr ) { \ 583 A3D_INITIALIZE_DATA( A3D_VOID_TYPE ## Data, _d ); \ 584 if( ntt ) A3D_VOID_TYPE ## Get( ntt, &_d ); \ 588 ~A3D_VOID_TYPE ## Wrapper( void ) { \ 589 A3D_VOID_TYPE ## Get( nullptr, &_d ); \ 593 DataType const *operator->() const { \ 600 DataType *operator->() { \ 607 void reset( A3D_VOID_TYPE *ntt ) { \ 608 A3D_VOID_TYPE ## Get( nullptr, &_d ); \ 609 if( ntt ) A3D_VOID_TYPE ## Get( ntt, &_d ); \ 782 template<
typename T,
typename S>
784 return std::vector<T>( d, d+sz );
789 std::pair<A3DBool, double> getUnitFromPO( A3DAsmProductOccurrence *po ) {
790 if(
nullptr == po ) {
791 return std::make_pair(static_cast<A3DBool>(
false ), 0. );
796 if(!d->m_bUnitFromCAD &&
nullptr != d->m_pPrototype ) {
797 return getUnitFromPO( d->m_pPrototype );
800 return std::make_pair( d->m_bUnitFromCAD, d->m_dUnit );
803 double getUnitFactor( std::vector<A3DAsmProductOccurrence*>
const &pos ) {
804 for(
auto po : pos ) {
805 auto po_unit = getUnitFromPO( po );
807 return po_unit.second;
810 auto const child_pos =
ts3d::toVector( d->m_ppPOccurrences, d->m_uiPOccurrencesSize );
811 return getUnitFactor( child_pos );
833 return (kA3DTypeRiRepresentationItem == t ||
834 kA3DTypeRiSet == t ||
835 kA3DTypeRiCurve == t ||
836 kA3DTypeRiPlane == t ||
837 kA3DTypeRiPointSet == t ||
838 kA3DTypeRiPolyWire == t ||
839 kA3DTypeRiPolyBrepModel == t ||
840 kA3DTypeRiBrepModel == t ||
841 kA3DTypeRiDirection == t);
848 return (kA3DTypeTessBase == t ||
849 kA3DTypeTess3D == t ||
850 kA3DTypeTess3DWire == t ||
851 kA3DTypeTessMarkup == t);
858 return (kA3DTypeMkpAnnotationItem == t ||
859 kA3DTypeMkpAnnotationSet == t ||
860 kA3DTypeMkpAnnotationReference == t);
866 static inline bool isMarkup( A3DEEntityType
const &t ) {
867 return (kA3DTypeMDPosition2D == t ||
868 kA3DTypeMDPosition3D == t ||
869 kA3DTypeMDPositionReference == t ||
870 kA3DTypeMarkupCoordinate == t ||
871 kA3DTypeMarkupText == t ||
872 kA3DTypeMDTextPosition == t ||
873 kA3DTypeMarkupRichText == t ||
874 kA3DTypeMarkupDimension == t ||
875 kA3DTypeMarkupDatum == t ||
876 kA3DTypeMarkupGDT == t ||
877 kA3DTypeMarkupRoughness == t ||
878 kA3DTypeMarkupBalloon == t ||
879 kA3DTypeMarkupFastener == t ||
880 kA3DTypeMarkupLocator == t ||
881 kA3DTypeMarkupMeasurementPoint == t ||
882 kA3DTypeMarkupLineWelding == t ||
883 kA3DTypeMarkupSpotWelding == t);
891 auto result = kA3DTypeUnknown;
892 if(
nullptr != ntt ) {
893 A3DEntityGetType( ntt, &
result );
903 enum class PrototypeOption {
914 static inline A3DAsmPartDefinition *
getPartDefinition( A3DAsmProductOccurrence *po, PrototypeOption
const &opt = PrototypeOption::Use ) {
915 if(
nullptr == po ) {
919 return d->m_pPart ? d->m_pPart : (opt == PrototypeOption::Use ?
getPartDefinition( d->m_pPrototype, opt ) : nullptr );
926 if(
nullptr == po ) {
938 static inline double getUnit( A3DAsmModelFile *modelFile ) {
940 return d->m_bUnitFromCAD ? d->m_dUnit : getUnitFactor(
toVector( d->m_ppPOccurrences, d->m_uiPOccurrencesSize ) );
946 #define kA3DTypeTopoVertex static_cast<A3DEEntityType>(kA3DTypeTopo + 18) 950 #define kA3DTypeMkpAnnotationEntity static_cast<A3DEEntityType>(kA3DTypeMkp + 7) 993 static inline EntitySet getUniqueParts( A3DAsmModelFile *modelFile );
1052 template <>
struct hash<A3DEEntityType> {
1053 size_t operator()(A3DEEntityType
const& s)
const noexcept {
1059 auto seed = i.size();
1060 auto const magic_number =
reinterpret_cast<size_t>( A3DAsmModelFileGet );
1061 for(
auto &ntt : i ) {
1062 seed ^=
reinterpret_cast<size_t>( ntt ) + magic_number + (seed << 6) + (seed >>2 );
1070 using namespace ts3d;
1071 using TypeSet = std::set<A3DEEntityType>;
1072 using TypePath = std::vector<A3DEEntityType>;
1073 using TypePathArray = std::vector<TypePath>;
1077 using GetterFunction = std::function<EntityArray (A3DEntity*)>;
1081 using GetterMap = std::unordered_map<A3DEEntityType, GetterFunction>;
1085 using GetterMapsByType = std::unordered_map<A3DEEntityType, GetterMap>;
1093 static GetterMapsByType _getterMapByType = {
1095 kA3DTypeAsmModelFile,
1098 kA3DTypeAsmProductOccurrence,
1099 [](A3DEntity *ntt) {
1101 return toVector( d->m_ppPOccurrences, d->m_uiPOccurrencesSize );
1107 kA3DTypeAsmProductOccurrence,
1110 kA3DTypeAsmProductOccurrence,
1111 [](A3DEntity *ntt) {
1116 kA3DTypeAsmPartDefinition,
1117 [](A3DEntity *ntt) {
1124 [](A3DEntity *ntt) {
1126 return toVector( d->m_ppViews, d->m_uiViewsSize );
1130 kA3DTypeGraphCamera,
1131 [](A3DEntity *ntt) {
1133 return toVector( d->m_ppCamera, d->m_uiCameraSize );
1137 kA3DTypeMkpAnnotationEntity,
1138 [](A3DEntity *ntt) {
1140 return toVector( d->m_ppAnnotations, d->m_uiAnnotationsSize );
1146 kA3DTypeAsmPartDefinition,
1149 kA3DTypeRiRepresentationItem,
1150 [](A3DEntity *ntt) {
1152 return toVector( d->m_ppRepItems, d->m_uiRepItemsSize );
1156 kA3DTypeMkpAnnotationEntity,
1157 [](A3DEntity *ntt) {
1159 return toVector( d->m_ppAnnotations, d->m_uiAnnotationsSize );
1164 []( A3DEntity *ntt) {
1166 return toVector( d->m_ppViews, d->m_uiViewsSize );
1172 kA3DTypeRiRepresentationItem,
1175 kA3DTypeRiRepresentationItem,
1176 [](A3DEntity *ntt) {
1179 return toVector( d->m_ppRepItems, d->m_uiRepItemsSize );
1185 kA3DTypeTopoBrepData,
1186 [](A3DEntity *ntt) {
1188 if( kA3DTypeRiBrepModel == ntt_type ) {
1191 }
else if( kA3DTypeRiPlane == ntt_type ) {
1199 kA3DTypeTopoSingleWireBody,
1200 [](A3DEntity *ntt) {
1211 kA3DTypeTopoBrepData,
1215 [](A3DEntity *ntt) {
1217 return toVector( d->m_ppConnexes, d->m_uiConnexSize );
1227 [](A3DEntity *ntt) {
1229 return toVector( d->m_ppShells, d->m_uiShellSize );
1239 [](A3DEntity *ntt) {
1241 return toVector( d->m_ppFaces, d->m_uiFaceSize );
1251 [](A3DEntity *ntt) {
1253 return toVector( d->m_ppLoops, d->m_uiLoopSize );
1263 [](A3DEntity *ntt) {
1265 return toVector( d->m_ppCoEdges, d->m_uiCoEdgeSize );
1275 []( A3DEntity *ntt ) {
1288 []( A3DEntity *ntt ) {
1291 result.reserve( 2 );
1292 result.push_back( d->m_pStartVertex );
1293 result.push_back( d->m_pEndVertex );
1300 kA3DTypeTopoSingleWireBody,
1303 kA3DTypeTopoWireEdge,
1304 []( A3DEntity *ntt ) {
1312 kA3DTypeMkpAnnotationEntity,
1315 kA3DTypeMkpAnnotationEntity,
1316 []( A3DEntity *ntt ) {
1319 return toVector( d->m_ppAnnotations, d->m_uiAnnotationsSize );
1325 kA3DTypeMiscMarkupLinkedItem,
1326 []( A3DEntity *ntt ) {
1327 if( kA3DTypeMkpAnnotationReference ==
getEntityType( ntt ) ) {
1329 return toVector( d->m_ppLinkedItems, d->m_uiLinkedItemsSize );
1336 []( A3DEntity *ntt ) {
1350 kA3DTypeMiscMarkupLinkedItem,
1351 []( A3DEntity *ntt ) {
1353 return toVector( d->m_ppLinkedItems, d->m_uiLinkedItemsSize );
1358 []( A3DEntity *ntt ) {
1360 return toVector( d->m_ppLeaders, d->m_uiLeadersSize );
1369 static inline TypeSet getPossibleParents( A3DEEntityType
const &child_type ) {
1370 static std::unordered_map<A3DEEntityType, TypeSet> _cache;
1371 auto const it = _cache.find( child_type );
1372 if( std::end( _cache ) != it ) {
1376 TypeSet possible_parents;
1377 for(
auto const owning_type_entry : _getterMapByType ) {
1378 auto const owning_type = owning_type_entry.first;
1379 for(
auto const child_type_entry : owning_type_entry.second ) {
1380 if( child_type_entry.first == child_type ) {
1381 possible_parents.insert( owning_type );
1386 _cache[child_type] = possible_parents;
1387 return possible_parents;
1392 static inline A3DEEntityType getBaseType( A3DEEntityType
const &entity_type ) {
1393 auto base_type = entity_type;
1395 base_type = kA3DTypeRiRepresentationItem;
1397 base_type = kA3DTypeTessBase;
1398 }
else if( kA3DTypeTopoUniqueVertex == entity_type || kA3DTypeTopoMultipleVertex == entity_type ) {
1399 base_type = kA3DTypeTopoVertex;
1401 base_type = kA3DTypeMkpAnnotationEntity;
1402 }
else if(
isMarkup( entity_type ) ) {
1403 base_type = kA3DTypeMkpMarkup;
1412 static TypePathArray getPossibleTypePaths( A3DEEntityType
const &parent_type, A3DEEntityType
const &child_type ) {
1415 static std::unordered_map< A3DEEntityType, std::unordered_map< A3DEEntityType, TypePathArray >> _cache;
1416 auto const parent_type_it = _cache.find( parent_type );
1417 if(std::end( _cache ) != parent_type_it ) {
1418 auto const child_type_it = parent_type_it->second.find( child_type );
1419 if( std::end( parent_type_it->second ) != child_type_it ) {
1420 return child_type_it->second;
1425 TypePathArray type_paths;
1426 auto const possible_parents = getPossibleParents( child_type );
1427 if( std::end( possible_parents ) != possible_parents.find( parent_type ) ) {
1430 type_path.push_back( parent_type );
1431 type_path.push_back( child_type );
1432 type_paths.push_back( type_path );
1437 for(
auto const intermediate_parent_type : possible_parents ) {
1438 if( intermediate_parent_type != child_type ) {
1439 auto const intermediate_type_paths = getPossibleTypePaths( parent_type, intermediate_parent_type );
1440 for(
auto const intermediate_type_path : intermediate_type_paths ) {
1441 type_paths.push_back( intermediate_type_path );
1442 type_paths.back().push_back( child_type );
1449 _cache[parent_type][child_type] = type_paths;
1456 auto const owner_base_type = getBaseType( owner_type );
1457 auto const owner_decomposer_it = _getterMapByType.find( owner_base_type );
1458 auto base_instance_path = instance_path;
1459 base_instance_path.push_back( owner );
1461 if(std::end( _getterMapByType ) == owner_decomposer_it ) {
1462 if( type_path.size() == 1 && owner_base_type == type_path.back() ) {
1463 instance_paths.push_back( base_instance_path );
1465 return instance_paths;
1469 if( kA3DTypeAsmProductOccurrence == owner_base_type ) {
1470 auto const children = owner_decomposer_it->second[kA3DTypeAsmProductOccurrence]( owner );
1471 if( !children.empty() ) {
1472 for(
auto child : children ) {
1473 auto const child_instance_paths = getInstancePaths( child, type_path, base_instance_path );
1474 std::copy( child_instance_paths.begin(), child_instance_paths.end(), std::back_inserter( instance_paths ) );
1477 }
else if( kA3DTypeRiSet == owner_type ) {
1478 auto const children = owner_decomposer_it->second[kA3DTypeRiRepresentationItem]( owner );
1479 if( !children.empty() ) {
1480 for(
auto child : children ) {
1481 auto const child_instance_paths = getInstancePaths( child, type_path, base_instance_path );
1482 std::copy( child_instance_paths.begin(), child_instance_paths.end(), std::back_inserter( instance_paths ) );
1484 return instance_paths;
1486 }
else if( kA3DTypeMkpAnnotationSet == owner_type ) {
1487 auto const children = owner_decomposer_it->second[kA3DTypeMkpAnnotationEntity]( owner );
1488 if( !children.empty() ) {
1489 for(
auto child : children ) {
1490 auto const child_instance_paths = getInstancePaths( child, type_path, base_instance_path );
1491 std::copy( child_instance_paths.begin(), child_instance_paths.end(), std::back_inserter( instance_paths ) );
1496 TypePath
const child_type_path( type_path.begin() + 1, type_path.end() );
1497 if(child_type_path.empty()) {
1498 instance_paths.push_back( base_instance_path );
1499 return instance_paths;
1501 auto const children = owner_decomposer_it->second[child_type_path.front()]( owner );
1502 for(
auto child : children ) {
1503 auto const child_instance_paths = getInstancePaths( child, child_type_path, base_instance_path );
1504 std::copy( child_instance_paths.begin(), child_instance_paths.end(), std::back_inserter( instance_paths ) );
1506 return instance_paths;
1512 auto const owner_base_type = getBaseType(
getEntityType( owner ) );
1513 auto const leaf_base_type = getBaseType( leaf_type );
1515 auto const possible_type_paths = getPossibleTypePaths( owner_base_type, leaf_base_type );
1516 for(
auto const possible_type_path : possible_type_paths ) {
1517 if( possible_type_path.empty() ) {
1520 auto const instance_paths = getInstancePaths( owner, possible_type_path );
1521 if( leaf_base_type != leaf_type ) {
1522 std::copy_if( instance_paths.begin(), instance_paths.end(), std::back_inserter( result ),
1524 auto const leaf_entity = instance_path.back();
1528 std::copy( instance_paths.begin(), instance_paths.end(), std::back_inserter( result ) );
1542 for(
auto path : paths ) {
1543 result.insert( path.back() );
1551 for(
auto path : paths) {
1552 result.insert( path.back() );
1553 instance_path_map[path.back()].emplace_back( path );
1559 auto result = instance_path;
1568 auto const owner_base_type = getBaseType( owner_type );
1569 auto const child_base_type = getBaseType( child_type );
1570 auto const owner_decomposer_it = _getterMapByType.find( owner_base_type );
1573 auto const decomposer_it = owner_decomposer_it->second.find(child_base_type);
1574 if (std::end(owner_decomposer_it->second) == decomposer_it) {
1577 auto const children = decomposer_it->second( owner );
1578 std::copy_if( std::begin( children ), std::end( children ), std::back_inserter( result ), [child_type, child_base_type]( A3DEntity *child ) {
1579 return child_type == child_base_type ||
getEntityType( child ) == child_type;
1586 static inline std::string getName( A3DEntity *ntt ) {
1593 if( kA3DTypeAsmProductOccurrence == t ) {
1595 return getName( d->m_pPrototype );
1598 return std::string();
1601 A3DMiscTransformation *getLocation( A3DAsmProductOccurrence *po ) {
1602 if(
nullptr == po ) {
1605 A3DAsmProductOccurrenceData d;
1606 A3D_INITIALIZE_DATA( A3DAsmModelFileData, d );
1607 A3DAsmProductOccurrenceGet( po, &d );
1608 auto location = d.m_pLocation;
1609 auto prototype = d.m_pPrototype;
1610 A3DAsmProductOccurrenceGet(
nullptr, &d );
1611 return location ? location : getLocation( prototype );
1642 : _path( other._path ) {
1649 : _path(
std::move( other._path ) ) {
1662 _path = other._path;
1669 _path = std::move( other._path );
1676 return _path == other._path;
1682 return ::getName( leaf() );
1688 return A3DMiscGetEntityTypeMsg( leafType() );
1700 if( _path.size() < 2 ) {
1703 auto owner_path = _path;
1704 owner_path.pop_back();
1712 if( new_path == _path ) {
1718 for(
auto attrib : _cascaded_attribs ) {
1719 A3DMiscCascadedAttributesDelete( attrib );
1722 _cascaded_attribs_data.reset(
nullptr );
1728 return _path.empty() ?
nullptr : _path.back();
1744 return A3D_TRUE == getCascadedAttributesData()->m_bRemoved;
1751 return A3D_TRUE == getCascadedAttributesData()->m_bShow;
1757 return getCascadedAttributesData()->m_sStyle;
1763 return getCascadedAttributesData()->m_usLayer;
1770 if( _cascaded_attribs.empty() ) {
1771 getCascadedAttributes();
1773 return _cascaded_attribs_data;
1777 A3DMiscCascadedAttributes *getCascadedAttributes(
void )
const {
1778 if(_cascaded_attribs.empty() ) {
1779 _cascaded_attribs.push_back(
nullptr );
1780 CheckResult( A3DMiscCascadedAttributesCreate( &_cascaded_attribs.back() ) );
1781 for(
auto ntt : _path ) {
1782 if( A3DEntityIsBaseWithGraphicsType( ntt ) ) {
1783 auto father = _cascaded_attribs.back();
1784 _cascaded_attribs.push_back(
nullptr );
1785 CheckResult( A3DMiscCascadedAttributesCreate( &_cascaded_attribs.back() ) );
1786 CheckResult( A3DMiscCascadedAttributesPush( _cascaded_attribs.back(), ntt, father ) );
1789 if( !_cascaded_attribs.empty() ) {
1790 _cascaded_attribs_data.reset( _cascaded_attribs.back() );
1793 return _cascaded_attribs.empty() ?
nullptr : _cascaded_attribs.back();
1799 mutable std::vector<A3DMiscCascadedAttributes*> _cascaded_attribs;
1815 throw std::invalid_argument(
"Expected leaf node type of A3DTessBase. " );
1825 return _d->m_pdCoords;
1831 return _d->m_uiCoordSize;
1845 TessFaceDataHelper( A3DTessFaceData
const &d, A3DUns32
const *triangulatedIndexes, A3DUns32
const *wireIndexes ) {
1846 auto sz_tri_idx = 0u;
1847 auto ti_index = d.m_uiStartTriangulated;
1848 if(kA3DTessFaceDataTriangle & d.m_usUsedEntitiesFlags) {
1849 auto const num_tris = d.m_puiSizesTriangulated[sz_tri_idx++];
1850 for(
auto tri = 0u; tri < num_tris; tri++) {
1851 for(
auto vert = 0u; vert < 3u; vert++) {
1852 _normals.push_back( triangulatedIndexes[ti_index++] );
1853 _vertices.push_back( triangulatedIndexes[ti_index++] );
1857 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleFan & d.m_usUsedEntitiesFlags) {
1858 auto const num_fans = d.m_puiSizesTriangulated[sz_tri_idx++];
1859 for(
auto fan_idx = 0u; fan_idx < num_fans; ++fan_idx) {
1860 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++];
1861 auto const root_n = triangulatedIndexes[ti_index++];
1862 auto const root_v = triangulatedIndexes[ti_index++];
1863 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
1864 _normals.push_back( root_n );
1865 _vertices.push_back( root_v );
1867 _normals.push_back( triangulatedIndexes[ti_index++] );
1868 _vertices.push_back( triangulatedIndexes[ti_index++] );
1870 _normals.push_back( triangulatedIndexes[ti_index] );
1871 _vertices.push_back( triangulatedIndexes[ti_index + 1] );
1876 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleStripe & d.m_usUsedEntitiesFlags) {
1877 auto const num_tri_stips = d.m_puiSizesTriangulated[sz_tri_idx++];
1878 for(
auto strip_idx = 0u; strip_idx < num_tri_stips; ++strip_idx) {
1879 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++];
1881 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
1882 auto const prev_n = triangulatedIndexes[ti_index - 2];
1883 auto const prev_v = triangulatedIndexes[ti_index - 1];
1884 auto const current_n = triangulatedIndexes[ti_index++];
1885 auto const current_v = triangulatedIndexes[ti_index++];
1886 auto const next_n = triangulatedIndexes[ti_index];
1887 auto const next_v = triangulatedIndexes[ti_index + 1];
1889 _normals.push_back( current_n );
1890 _vertices.push_back( current_v );
1891 _normals.push_back( vert % 2 ? next_n : prev_n );
1892 _vertices.push_back( vert % 2 ? next_v : prev_v );
1893 _normals.push_back( vert % 2 ? prev_n : next_n );
1894 _vertices.push_back( vert % 2 ? prev_v : next_v );
1899 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleOneNormal & d.m_usUsedEntitiesFlags) {
1900 auto const num_tris_1normal = d.m_puiSizesTriangulated[sz_tri_idx++];
1901 for(
auto tri = 0u; tri < num_tris_1normal; tri++) {
1902 auto n = triangulatedIndexes[ti_index++];
1903 for(
auto vert = 0u; vert < 3u; vert++) {
1904 _normals.push_back( n );
1905 _vertices.push_back( triangulatedIndexes[ti_index++] );
1910 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleFanOneNormal & d.m_usUsedEntitiesFlags) {
1911 auto const num_fans_1normal = d.m_puiSizesTriangulated[sz_tri_idx++];
1912 for(
auto fan_idx = 0u; fan_idx < num_fans_1normal; ++fan_idx) {
1913 auto const has_vertex_normals = 0 == (d.m_puiSizesTriangulated[sz_tri_idx] & kA3DTessFaceDataNormalSingle);
1914 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++] & kA3DTessFaceDataNormalMask;
1915 auto const root_n = triangulatedIndexes[ti_index++];
1916 auto const root_v = triangulatedIndexes[ti_index++];
1917 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
1918 auto const n = (has_vertex_normals ? triangulatedIndexes[ti_index++] : root_n);
1919 auto const v = triangulatedIndexes[ti_index++];
1921 auto const next_n = (has_vertex_normals ? triangulatedIndexes[ti_index] : root_n);
1922 auto const next_v = triangulatedIndexes[ti_index + (has_vertex_normals ? 1 : 0)];
1924 _normals.push_back( root_n );
1925 _vertices.push_back( root_v );
1926 _normals.push_back( n );
1927 _vertices.push_back( v );
1928 _normals.push_back( next_n );
1929 _vertices.push_back( next_v );
1931 ti_index += (has_vertex_normals ? 2 : 1);
1934 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleStripeOneNormal & d.m_usUsedEntitiesFlags) {
1935 auto const num_tri_stips = d.m_puiSizesTriangulated[sz_tri_idx++];
1936 for(
auto strip_idx = 0u; strip_idx < num_tri_stips; ++strip_idx) {
1937 auto const has_vertex_normals = 0 == (d.m_puiSizesTriangulated[sz_tri_idx] & kA3DTessFaceDataNormalSingle);
1938 auto const series_normal = triangulatedIndexes[ti_index];
1939 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++] & kA3DTessFaceDataNormalMask;
1941 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
1942 auto const prev_n = (has_vertex_normals ? triangulatedIndexes[ti_index - 2] : series_normal);
1943 auto const prev_v = triangulatedIndexes[ti_index - 1];
1945 auto const current_n = (has_vertex_normals ? triangulatedIndexes[ti_index++] : series_normal);
1946 auto const current_v = triangulatedIndexes[ti_index++];
1948 auto const next_n = (has_vertex_normals ? triangulatedIndexes[ti_index] : series_normal);
1949 auto const next_v = triangulatedIndexes[ti_index + (has_vertex_normals ? 1 : 0)];
1951 _normals.push_back( current_n );
1952 _vertices.push_back( current_v );
1953 _normals.push_back( vert % 2 ? next_n : prev_n );
1954 _vertices.push_back( vert % 2 ? next_v : prev_v );
1955 _normals.push_back( vert % 2 ? prev_n : next_n );
1956 _vertices.push_back( vert % 2 ? prev_v : next_v );
1958 ti_index += (has_vertex_normals ? 2 : 1);
1961 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleTextured & d.m_usUsedEntitiesFlags) {
1962 auto const num_tris = d.m_puiSizesTriangulated[sz_tri_idx++];
1963 for(
auto tri_idx = 0u; tri_idx < num_tris; tri_idx++) {
1964 for(
auto vert_idx = 0u; vert_idx < 3u; vert_idx++) {
1965 _normals.push_back( triangulatedIndexes[ti_index++] );
1966 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
1967 _texture.push_back( triangulatedIndexes[ti_index++] );
1969 _vertices.push_back( triangulatedIndexes[ti_index++] );
1973 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleFanTextured & d.m_usUsedEntitiesFlags) {
1974 auto const num_fans_textured = d.m_puiSizesTriangulated[sz_tri_idx++];
1975 for(
auto fan_idx = 0u; fan_idx < num_fans_textured; ++fan_idx) {
1976 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++];
1977 auto const n = triangulatedIndexes[ti_index++];
1978 std::vector<A3DUns32> t;
1979 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
1980 t.push_back( triangulatedIndexes[ti_index++] );
1982 auto const v = triangulatedIndexes[ti_index++];
1983 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
1984 _normals.push_back( n );
1985 _texture.insert( _texture.end(), t.begin(), t.end() );
1986 _vertices.push_back( v );
1988 _normals.push_back( triangulatedIndexes[ti_index++] );
1989 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
1990 _texture.push_back( triangulatedIndexes[ti_index++] );
1992 _vertices.push_back( triangulatedIndexes[ti_index++] );
1994 _normals.push_back( triangulatedIndexes[ti_index++] );
1995 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
1996 _texture.push_back( triangulatedIndexes[ti_index++] );
1998 _vertices.push_back( triangulatedIndexes[ti_index++] );
2002 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleStripeTextured & d.m_usUsedEntitiesFlags) {
2003 auto const num_tri_stips = d.m_puiSizesTriangulated[sz_tri_idx++];
2004 for(
auto strip_idx = 0u; strip_idx < num_tri_stips; ++strip_idx) {
2005 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++];
2006 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
2007 auto const prev_n = triangulatedIndexes[ti_index - (2 + d.m_uiTextureCoordIndexesSize)];
2008 std::vector<A3DUns32> prev_t;
2009 for(
auto i = ti_index - (1 + d.m_uiTextureCoordIndexesSize); i < ti_index - 1; ++i ) {
2010 prev_t.push_back( triangulatedIndexes[i] );
2012 auto const prev_v = triangulatedIndexes[ti_index - 1];
2014 auto const current_n = triangulatedIndexes[ti_index++];
2015 std::vector<A3DUns32> current_t;
2016 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2017 current_t.push_back( triangulatedIndexes[ti_index++] );
2019 auto const current_v = triangulatedIndexes[ti_index++];
2021 auto const next_n = triangulatedIndexes[ti_index];
2022 std::vector<A3DUns32> next_t;
2023 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2024 next_t.push_back( triangulatedIndexes[ ti_index + i + 1] );
2026 auto const next_v = triangulatedIndexes[ti_index + 1 + d.m_uiTextureCoordIndexesSize];
2028 _normals.push_back( current_n );
2029 _texture.insert( _texture.end(), current_t.begin(), current_t.end() );
2030 _vertices.push_back( current_v );
2032 _normals.push_back( vert % 2 ? next_n : prev_n );
2033 _texture.insert( _texture.end(), vert % 2 ? next_t.begin() : prev_t.begin(), vert % 2 ? next_t.end() : prev_t.end() );
2034 _vertices.push_back( vert % 2 ? next_v : prev_v );
2036 _normals.push_back( vert % 2 ? prev_n : next_n );
2037 _texture.insert( _texture.end(), vert % 2 ? prev_t.begin() : next_t.begin(), vert % 2 ? prev_t.end() : next_t.end() );
2038 _vertices.push_back( vert % 2 ? prev_v : next_v );
2042 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleOneNormalTextured & d.m_usUsedEntitiesFlags) {
2043 auto const has_vertex_normals = 0 == (d.m_puiSizesTriangulated[sz_tri_idx] & kA3DTessFaceDataNormalSingle);
2044 auto const series_normal = triangulatedIndexes[ti_index];
2045 auto const num_tris_1normal_textured = d.m_puiSizesTriangulated[sz_tri_idx++];
2046 for(
auto tri = 0u; tri < num_tris_1normal_textured; tri++) {
2047 for(
auto vert = 0u; vert < 3u; vert++) {
2048 _normals.push_back( has_vertex_normals ? triangulatedIndexes[ti_index++] : series_normal );
2049 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2050 _texture.push_back( triangulatedIndexes[ti_index++] );
2052 _vertices.push_back( triangulatedIndexes[ti_index++] );
2056 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleFanOneNormalTextured & d.m_usUsedEntitiesFlags) {
2057 auto const num_fans_textured = d.m_puiSizesTriangulated[sz_tri_idx++];
2058 for(
auto fan_idx = 0u; fan_idx < num_fans_textured; ++fan_idx) {
2059 auto const root_n = triangulatedIndexes[ti_index++];
2060 std::vector<A3DUns32> root_t;
2061 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2062 root_t.push_back( triangulatedIndexes[ti_index++] );
2064 auto const root_v = triangulatedIndexes[ti_index++];
2065 auto const has_vertex_normals = 0 == (d.m_puiSizesTriangulated[sz_tri_idx] & kA3DTessFaceDataNormalSingle);
2066 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++] & kA3DTessFaceDataNormalMask;
2067 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
2068 _normals.push_back( root_n );
2069 _texture.insert( _texture.end(), root_t.begin(), root_t.end() );
2070 _vertices.push_back( root_v );
2072 _normals.push_back( has_vertex_normals ? triangulatedIndexes[ti_index++] : root_n );
2073 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2074 _texture.push_back( triangulatedIndexes[ti_index++] );
2076 _vertices.push_back( triangulatedIndexes[ti_index++] );
2078 _normals.push_back( has_vertex_normals ? triangulatedIndexes[ti_index] : root_n );
2079 for(
auto i = 0u; i < d.m_uiTextureCoordIndexesSize; ++i ) {
2080 _texture.push_back( triangulatedIndexes[ti_index + i + 1] );
2082 _vertices.push_back( triangulatedIndexes[ti_index + 1 + (has_vertex_normals ? d.m_uiTextureCoordIndexesSize : 0)] );
2086 if(d.m_uiSizesTriangulatedSize > sz_tri_idx && kA3DTessFaceDataTriangleStripeOneNormalTextured & d.m_usUsedEntitiesFlags) {
2087 auto const num_tri_stips = d.m_puiSizesTriangulated[sz_tri_idx++];
2088 for(
auto strip_idx = 0u; strip_idx < num_tri_stips; ++strip_idx) {
2089 auto const has_vertex_normals = 0 == (d.m_puiSizesTriangulated[sz_tri_idx] & kA3DTessFaceDataNormalSingle);
2090 auto const num_pts = d.m_puiSizesTriangulated[sz_tri_idx++] & kA3DTessFaceDataNormalMask;
2091 auto const series_normal = triangulatedIndexes[ti_index];
2092 ti_index += 2 + d.m_uiStyleIndexesSize;
2093 for(
auto vert = 1u; vert < num_pts - 1u; vert++) {
2094 auto const prev_n = has_vertex_normals ? triangulatedIndexes[ti_index - (2 + d.m_uiTextureCoordIndexesSize)] : series_normal;
2095 auto const prev_v = triangulatedIndexes[ti_index - 1];
2098 auto const current_n = has_vertex_normals ? triangulatedIndexes[ti_index++] : series_normal;
2099 ti_index += d.m_uiTextureCoordIndexesSize;
2100 auto const current_v = triangulatedIndexes[ti_index++];
2102 auto const next_n = has_vertex_normals ? triangulatedIndexes[ti_index] : series_normal;
2103 auto const next_v = triangulatedIndexes[ti_index + 1 + (has_vertex_normals ? d.m_uiTextureCoordIndexesSize : 0)];
2105 _normals.push_back( current_n );
2106 _vertices.push_back( current_v );
2107 _normals.push_back( vert % 2 ? next_n : prev_n );
2108 _vertices.push_back( vert % 2 ? next_v : prev_v );
2109 _normals.push_back( vert % 2 ? prev_n : next_n );
2110 _vertices.push_back( vert % 2 ? prev_v : next_v );
2115 auto wi_index = d.m_uiStartWire;
2117 for(
auto idx = 0u; idx < d.m_uiSizesWiresSize; ++idx ) {
2118 auto const nverts_with_flags = d.m_puiSizesWires[idx];
2119 auto const nvertices = nverts_with_flags & ~kA3DTessFaceDataWireIsClosing & ~kA3DTessFaceDataWireIsNotDrawn;
2120 auto const is_closing = nverts_with_flags & kA3DTessFaceDataWireIsClosing;
2121 auto const is_hidden = nverts_with_flags & kA3DTessFaceDataWireIsNotDrawn;
2123 current_edge.
_visible = !is_hidden;
2124 for(
auto vidx = 0u; vidx < nvertices; ++vidx ) {
2125 current_edge.
_vertices.push_back( wireIndexes[wi_index++] );
2127 current_loop.
_edges.push_back( current_edge );
2130 _loops.push_back( current_loop );
2131 current_loop.
_edges.clear();
2137 : _vertices( other._vertices ), _normals( other._normals ), _texture( other._texture ) {
2142 : _vertices( std::move( other._vertices ) ), _normals( std::move( other._normals ) ), _texture( std::move( other._texture ) ) {
2148 _vertices = other._vertices;
2149 _normals = other._normals;
2150 _texture = other._texture;
2155 _vertices = std::move( other._vertices );
2156 _normals = std::move( other._normals );
2157 _texture = std::move( other._texture );
2177 std::vector<A3DUns32>
const &
normals(
void )
const {
2209 std::vector<TessLoop>
const loops(
void )
const {
2214 std::vector<A3DUns32> _vertices, _normals, _texture;
2215 std::vector<TessLoop> _loops;
2228 if( kA3DTypeTess3D != leafType() ) {
2229 throw std::invalid_argument(
"Expected A3DTess3D leaf not type." );
2238 return _d->m_pdNormals;
2244 return _d->m_uiNormalSize;
2251 return _d->m_pdTextureCoords;
2257 return _d->m_uiTextureCoordSize;
2264 return _d->m_uiFaceTessSize;
2273 if( face_idx >= _d->m_uiFaceTessSize ) {
2274 throw std::out_of_range(
"Index of face requested for index mesh is out of range." );
2276 return TessFaceDataHelper( _d->m_psFaceTessData[face_idx], _d->m_puiTriangulatedIndexes, _d->m_puiWireIndexes );
2295 A3DUns32 getNumberOfWires(
void )
const;
2318 ColorSpec getColorSpecification(
void )
const;
2346 throw std::invalid_argument(
"The leaf node in the instance path must be a representation item." );
2356 auto tess_type = kA3DTypeUnknown;
2357 A3DEntityGetType( d->m_pTessBase, &tess_type );
2358 auto tess_path = path();
2359 tess_path.push_back( d->m_pTessBase );
2360 switch( tess_type ) {
2361 case kA3DTypeTess3D:
2362 return std::make_shared<Tess3DInstance>( tess_path );
2364 case kA3DTypeTess3DWire:
2377 return A3D_TRUE == getCascadedAttributesData( face_idx )->m_bRemoved;
2384 return A3D_TRUE == getCascadedAttributesData( face_idx )->m_bShow;
2390 return getCascadedAttributesData( face_idx )->m_sStyle;
2396 return getCascadedAttributesData( face_idx )->m_usLayer;
2402 if( _cascaded_attribs.empty() ) {
2403 getCascadedAttributes();
2406 auto cascaded_attribs_copy = _cascaded_attribs;
2407 auto father = cascaded_attribs_copy.back();
2408 cascaded_attribs_copy.push_back(
nullptr );
2409 CheckResult( A3DMiscCascadedAttributesCreate( &cascaded_attribs_copy.back() ) );
2413 CheckResult( A3DMiscCascadedAttributesPushTessFace( cascaded_attribs_copy.back(), leaf(), d->m_pTessBase, &tess_d->m_psFaceTessData[face_idx], face_idx, father ) );
2415 CheckResult( A3DMiscCascadedAttributesDelete( cascaded_attribs_copy.back() ) );
2420 inline A3DVector3dData zeroVector(
void ) {
2422 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2423 result.m_dX = result.m_dY = result.m_dZ = 0.;
2428 inline A3DVector3dData operator+(A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2430 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2431 result.m_dX = lhs.m_dX + rhs.m_dX;
2432 result.m_dY = lhs.m_dY + rhs.m_dY;
2433 result.m_dZ = lhs.m_dZ + rhs.m_dZ;
2437 inline A3DVector3dData &operator+=(A3DVector3dData &lhs, A3DVector3dData
const &rhs ) {
2442 inline A3DVector3dData operator-(A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2444 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2445 result.m_dX = lhs.m_dX - rhs.m_dX;
2446 result.m_dY = lhs.m_dY - rhs.m_dY;
2447 result.m_dZ = lhs.m_dZ - rhs.m_dZ;
2451 inline A3DVector3dData operator-( A3DVector3dData
const &lhs ) {
2453 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2454 result.m_dX = -lhs.m_dX;
2455 result.m_dY = -lhs.m_dY;
2456 result.m_dZ = -lhs.m_dZ;
2460 inline A3DVector3dData &operator-=(A3DVector3dData &lhs, A3DVector3dData
const &rhs ) {
2465 inline A3DVector3dData operator*(A3DVector3dData
const &lhs,
double const &rhs ) {
2467 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2468 result.m_dX = lhs.m_dX * rhs;
2469 result.m_dY = lhs.m_dY * rhs;
2470 result.m_dZ = lhs.m_dZ * rhs;
2474 inline A3DVector3dData operator*(
double const &lhs, A3DVector3dData
const &rhs ) {
2478 inline A3DVector3dData &operator*=(A3DVector3dData &lhs,
double const &rhs ) {
2485 inline A3DVector3dData operator/(A3DVector3dData
const &lhs,
double const &rhs ) {
2487 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2488 result.m_dX = lhs.m_dX / rhs;
2489 result.m_dY = lhs.m_dY / rhs;
2490 result.m_dZ = lhs.m_dZ / rhs;
2494 inline A3DVector3dData &operator/=(A3DVector3dData &lhs,
double const &rhs ) {
2501 inline A3DVector3dData cross( A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2503 A3D_INITIALIZE_DATA( A3DVector3dData, result );
2504 result.m_dX = lhs.m_dY * rhs.m_dZ - lhs.m_dZ * rhs.m_dY;
2505 result.m_dY = lhs.m_dZ * rhs.m_dX - lhs.m_dX * rhs.m_dZ;
2506 result.m_dZ = lhs.m_dX * rhs.m_dY - lhs.m_dY * rhs.m_dX;
2510 inline double dot( A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2511 return lhs.m_dX * rhs.m_dX + lhs.m_dY * rhs.m_dY + lhs.m_dZ * rhs.m_dZ;
2514 inline double length2( A3DVector3dData
const &v ) {
2518 inline double length( A3DVector3dData
const &v ) {
2519 return sqrt( length2( v ) );
2522 inline A3DVector3dData& normalize( A3DVector3dData &v ) {
2527 inline A3DVector3dData normalized( A3DVector3dData
const &v ) {
2529 return normalize(
result );
2532 inline bool operator==(A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2533 static auto const RESOLUTION = 1.e-9;
2534 return length( lhs - rhs ) < RESOLUTION;
2537 inline bool operator!=(A3DVector3dData
const &lhs, A3DVector3dData
const &rhs ) {
2538 static auto const RESOLUTION = 1.e-9;
2539 return length( lhs - rhs ) > RESOLUTION;
2542 inline A3DBoundingBoxData &include( A3DBoundingBoxData &bb, A3DVector3dData
const &pt ) {
2543 bb.m_sMin.m_dX = std::min( bb.m_sMin.m_dX, pt.m_dX );
2544 bb.m_sMin.m_dY = std::min( bb.m_sMin.m_dY, pt.m_dY );
2545 bb.m_sMin.m_dZ = std::min( bb.m_sMin.m_dZ, pt.m_dZ );
2547 bb.m_sMax.m_dX = std::max( bb.m_sMax.m_dX, pt.m_dX );
2548 bb.m_sMax.m_dY = std::max( bb.m_sMax.m_dY, pt.m_dY );
2549 bb.m_sMax.m_dZ = std::max( bb.m_sMax.m_dZ, pt.m_dZ );
2554 inline A3DVector3dData center( A3DBoundingBoxData
const &bb ) {
2555 return bb.m_sMin + (bb.m_sMax - bb.m_sMin) * 0.5;
2560 #pragma warning(pop) Provides a wrapper for accessing A3DTopoShellData.
Definition: ExchangeToolkit.h:770
Provides a wrapper for accessing A3DAsmPartDefinitionData.
Definition: ExchangeToolkit.h:619
Provides a wrapper for accessing A3DMkpMarkupData.
Definition: ExchangeToolkit.h:725
static bool isMarkup(A3DEEntityType const &t)
Check if type is A3DMkpMarkup or derived type.
Definition: ExchangeToolkit.h:866
std::unordered_map< A3DEntity *, InstancePathArray > InstancePathMap
Used for looking up instance path for a given unique child.
Definition: ExchangeToolkit.h:998
Provides a wrapper for accessing A3DTessBaseData.
Definition: ExchangeToolkit.h:759
double const * normals(void) const
Obtains a pointer to an array of normal coordinates. The length of this array is determined by normal...
Definition: ExchangeToolkit.h:2237
bool operator==(Instance const &other) const
Compare paths.
Definition: ExchangeToolkit.h:1675
static double getUnit(A3DAsmModelFile *modelFile)
Obtains the unit scaling factor (units/mm) for a given input model file.
Definition: ExchangeToolkit.h:938
bool _closed
Indicated if the wire is closing.
Definition: ExchangeToolkit.h:2303
Provides a wrapper for accessing A3DRiCurveData.
Definition: ExchangeToolkit.h:730
A3DUns32 texCoordsSize(void) const
Provides the length of the texCoords array.
Definition: ExchangeToolkit.h:2256
std::vector< A3DUns32 > const & vertices(void) const
Gets the list of vertex index values defining the triangles of the mesh for this face. The length of this vector should be a multiple of 3. Index values should be accessed as triplets, each value defining the offset in the TessBaseInstance::coords() array.
Definition: ExchangeToolkit.h:2167
Provides a wrapper for accessing A3DRiBrepModelData.
Definition: ExchangeToolkit.h:728
std::string getName(void) const
Gets the object name.
Definition: ExchangeToolkit.h:1681
std::vector< A3DUns32 > _vertices
Array indexes for the vertices.
Definition: ExchangeToolkit.h:2193
Provides easy access to wire tessellation data.
Definition: ExchangeToolkit.h:2287
Provides a wrapper for accessing A3DTopoBrepDataData.
Definition: ExchangeToolkit.h:762
Provides a wrapper for accessing A3DMkpAnnotationSetData.
Definition: ExchangeToolkit.h:723
TessFaceDataHelper getIndexMeshForFace(A3DUns32 const &face_idx) const
Gets an object that wraps the tessellation data of a given face.
Definition: ExchangeToolkit.h:2272
A3DGraphStyleData getNetStyle(void) const
Gets the net style.
Definition: ExchangeToolkit.h:1756
A3DGraphStyleData getNetStyle(A3DUns32 const face_idx) const
Gets the net style.
Definition: ExchangeToolkit.h:2389
bool _connected_to_previous
Indicates if the wire is connected to the previous wire.
Definition: ExchangeToolkit.h:2305
Provides a wrapper for accessing A3DMkpAnnotationReferenceData.
Definition: ExchangeToolkit.h:722
Encapsulates the functionality desired to easily retrieve normal and texture coordinates for a tessel...
Definition: ExchangeToolkit.h:2222
Base class for easing access to tessellation data. Provides access to coordinate values.
Definition: ExchangeToolkit.h:1808
static A3DAsmPartDefinition * getPartDefinition(A3DAsmProductOccurrence *po, PrototypeOption const &opt=PrototypeOption::Use)
Gets a part definition from a product occurrence, optionally using recursion to query the prototype...
Definition: ExchangeToolkit.h:914
A collection of TessEdge objects representing a single closed series of edges that bound a face...
Definition: ExchangeToolkit.h:2201
static bool isTessBase(A3DEEntityType const &t)
Check if type is TessBase or derived TessBase type.
Definition: ExchangeToolkit.h:847
std::string getType(void) const
Gets the object type as a string.
Definition: ExchangeToolkit.h:1687
std::shared_ptr< Instance > InstancePtr
Abstraction of a shared pointer to an Instance object.
Definition: ExchangeToolkit.h:1620
bool getNetShow(void) const
Gets the net show.
Definition: ExchangeToolkit.h:1750
Provides a wrapper for accessing A3DRootBaseData.
Definition: ExchangeToolkit.h:738
bool getNetRemoved(void) const
Gets the net removed.
Definition: ExchangeToolkit.h:1743
Provides a wrapper for accessing A3DTopoSingleWireBodyData.
Definition: ExchangeToolkit.h:771
std::vector< TessEdge > _edges
Collection of edges that make up this loop.
Definition: ExchangeToolkit.h:2203
TessBaseInstance(InstancePath const &path)
throws if leaf type is not "derived" from A3DTessBase
Definition: ExchangeToolkit.h:1812
Provides a wrapper for accessing A3DAsmModelFileData.
Definition: ExchangeToolkit.h:618
Provides a wrapper for accessing A3DTopoConnexData.
Definition: ExchangeToolkit.h:764
A3DEEntityType leafType(void) const
Gets the type of the leaf entity.
Definition: ExchangeToolkit.h:1733
std::vector< A3DUns32 > const & normals(void) const
Gets the list of vertex index values defining the normal vectors at each vertex location. The length of this vector should be a multiple of 3. Index values should be accessed as triplets, each value defining the offset in the Tess3DInstance::normals() array.
Definition: ExchangeToolkit.h:2177
This class is used to log calls to the Exchange API.
Definition: ExchangeToolkit.h:477
static InstancePathArray getLeafInstances(A3DEntity *owner, A3DEEntityType const &leaf_type)
Returns an array of instance paths, each with a leaf entity type corresponding to leaf_type...
Definition: ExchangeToolkit.h:1510
bool _record(std::string const file, int const line_no, std::string const fn, A3DStatus const result)
Used internally by the CheckResult macro to log a function call.
Definition: ExchangeToolkit.h:525
ColorSpec
How color is specified.
Definition: ExchangeToolkit.h:2310
Provides a wrapper for accessing A3DTopoEdgeData.
Definition: ExchangeToolkit.h:766
Provides a wrapper for accessing A3DMkpAnnotationItemData.
Definition: ExchangeToolkit.h:721
This specific type of an Instance expects the leaf node to be of type kA3DTypeRiRepresentationItem.
Definition: ExchangeToolkit.h:2339
int const & line(void) const
Gets the line number where the last call was invoked from.
Definition: ExchangeToolkit.h:505
std::shared_ptr< TessBaseInstance > getTessellation(void) const
Provides a concrete type for the tessellation instance Will be one of type:
Definition: ExchangeToolkit.h:2354
virtual ~Instance(void)
Destructor.
Definition: ExchangeToolkit.h:1655
EntityArray InstancePath
The InstancePath type is used to identify a particular path through the hierarchy of Exchange objects...
Definition: ExchangeToolkit.h:963
InstancePath const & path(void) const
Gets the InstancePath this Instance references.
Definition: ExchangeToolkit.h:1693
Instance(Instance &&other)
Move constructor.
Definition: ExchangeToolkit.h:1648
std::set< A3DEntity * > EntitySet
Used to absract an unordered collection of unique Exchange objects.
Definition: ExchangeToolkit.h:827
A3DStatus const & result(void) const
Gets the return code resulting from the last function call.
Definition: ExchangeToolkit.h:517
bool _visible
Visibility flag.
Definition: ExchangeToolkit.h:2195
static bool isRepresentationItem(A3DEEntityType const &t)
Check if type is Ri or derived Ri type.
Definition: ExchangeToolkit.h:832
Instance & operator=(Instance &&other)
Move assign.
Definition: ExchangeToolkit.h:1668
#define A3D_HELPERS(A3D_VOID_TYPE)
This macro is used to define a struct that can be used to more easily obtain and access the Exchange ...
Definition: ExchangeToolkit.h:570
A3DUns32 faceSize(void) const
Provides the total number of faces with available tessellation data.
Definition: ExchangeToolkit.h:2263
Instance owner(void) const
Gets an Instance object for the parent.
Definition: ExchangeToolkit.h:1699
bool getNetRemoved(A3DUns32 const face_idx) const
Gets the net removed.
Definition: ExchangeToolkit.h:2376
Provides a wrapper for accessing A3DTopoFaceData.
Definition: ExchangeToolkit.h:767
Structure describing wire data.
Definition: ExchangeToolkit.h:2299
std::vector< T > toVector(T *d, S const &sz)
This function can be used to more easily construct a vector of objects.
Definition: ExchangeToolkit.h:783
An instance should be thought of as a specific path through the Exchange product structure to a parti...
Definition: ExchangeToolkit.h:1630
A3DUns16 getNetLayer(A3DUns32 const face_idx) const
Gets the net layer.
Definition: ExchangeToolkit.h:2395
Instance(InstancePath const &path)
Constructs an Instance from the provided InstancePath.
Definition: ExchangeToolkit.h:1634
static CheckResult & instance(void)
Gets the global instances of the CheckResult object. The returned object can be used to examine infor...
Definition: ExchangeToolkit.h:484
A3DUns32 coordsSize(void) const
The length of the coords() array.
Definition: ExchangeToolkit.h:1830
The ts3d namespace is used to contain all Exchange Toolkit functionality.
Definition: ExchangeEigenBridge.h:6
Provides a wrapper for accessing A3DTopoLoopData.
Definition: ExchangeToolkit.h:768
std::vector< InstancePath > InstancePathArray
Used as a collection of InstancePath objects. When you ask for all leaf nodes of a particular leaf no...
Definition: ExchangeToolkit.h:971
static EntitySet getUniqueLeafEntities(A3DEntity *owner, A3DEEntityType const &leaf_type)
Returns a set of A3DEntity pointers that are unique leaf entities of type leaf_type of the provided o...
Definition: ExchangeToolkit.h:1539
std::vector< A3DUns32 > _vertices
The vertex index values.
Definition: ExchangeToolkit.h:2301
Provides a wrapper for accessing A3DRiRepresentationItemData.
Definition: ExchangeToolkit.h:736
std::vector< A3DEntity * > EntityArray
Used to abstract an ordered collection of Exchange objects.
Definition: ExchangeToolkit.h:822
static InstancePath getOwningInstance(InstancePath const &instance_path, A3DEEntityType const &owner_type)
Easily obtain a subset of an InstancePath with a final node of a specific type.
Definition: ExchangeToolkit.h:1558
static bool isAnnotationEntity(A3DEEntityType const &t)
Check if type is A3DMkpAnnotationEntity or derived type.
Definition: ExchangeToolkit.h:857
ColorApplication
How is the color applied?
Definition: ExchangeToolkit.h:2321
bool getNetShow(A3DUns32 const face_idx) const
Gets the net show.
Definition: ExchangeToolkit.h:2383
void reset(InstancePath const &new_path)
Resets the InstancePath this Instance references.
Definition: ExchangeToolkit.h:1711
static EntitySet getUniqueChildren(A3DEntity *owner, A3DEEntityType const &leaf_type)
Definition: ExchangeToolkit.h:1011
Provides a wrapper for accessing A3DTess3DWireData.
Definition: ExchangeToolkit.h:758
A3DUns16 getNetLayer(void) const
Gets the net layer.
Definition: ExchangeToolkit.h:1762
double const * coords(void) const
Gets the array of coordinate values for the tesselation. This array is of length coordsSize().
Definition: ExchangeToolkit.h:1824
Provides a wrapper for accessing A3DRiSetData.
Definition: ExchangeToolkit.h:737
Provides a wrapper for accessing A3DTopoCoEdgeData.
Definition: ExchangeToolkit.h:763
Provides a wrapper for accessing A3DMiscCascadedAttributesData.
Definition: ExchangeToolkit.h:714
std::vector< A3DUns32 > const & textures(void) const
Gets the list of texture coordinate values.
Definition: ExchangeToolkit.h:2184
std::vector< TessLoop > const loops(void) const
Provides a list of TessLoop objects representing the edge loops that bound this face.
Definition: ExchangeToolkit.h:2209
static EntityArray getChildren(A3DEntity *parent, A3DEEntityType const &child_type)
Gets all immediate children (if any) of a specified type from a parent object.
Definition: ExchangeToolkit.h:1566
A3DUns32 normalsSize(void) const
Provides the size of the normal array.
Definition: ExchangeToolkit.h:2243
std::string const & fn(void) const
Gets the stringified representation of the last function call.
Definition: ExchangeToolkit.h:511
Tess3DInstance(InstancePath const &path)
Throws if leaf type is not kA3DTypeTess3D.
Definition: ExchangeToolkit.h:2226
static A3DEEntityType getEntityType(A3DEntity *ntt)
A simple wrapper to allow use inline without having to declare a temporary variable to the return val...
Definition: ExchangeToolkit.h:890
RepresentationItemInstance(InstancePath const &path)
throws if leaf entity is not type kA3DTypeRiRepresentationItem
Definition: ExchangeToolkit.h:2343
double const * texCoords(void) const
Obtains a pointer to an array of texture coordinates. The length of this array is determined by texCo...
Definition: ExchangeToolkit.h:2250
Provides a wrapper for accessing A3DAsmProductOccurrenceData.
Definition: ExchangeToolkit.h:620
void setFailureCallback(std::function< bool(CheckResult const &)> failure_cb)
Sets the callback function that is invoked when an call is made and the result value is not A3D_SUCCE...
Definition: ExchangeToolkit.h:493
This is a helper class used to more easily provide access to the indexed mesh data for a given face...
Definition: ExchangeToolkit.h:1842
Provides a wrapper for accessing A3DRiPlaneData.
Definition: ExchangeToolkit.h:732
static EntityArray getProductOccurrences(A3DAsmProductOccurrence *po, PrototypeOption const &opt=PrototypeOption::Use)
Gets the child product occurrences from a parent, optionally using recursion to query the prototype...
Definition: ExchangeToolkit.h:925
Index list of vertices for the tessellation of a specific edge.
Definition: ExchangeToolkit.h:2191
Instance(Instance const &other)
Copy constructor.
Definition: ExchangeToolkit.h:1641
std::string const & file(void) const
Gets the filename where the last call was invoked from.
Definition: ExchangeToolkit.h:499
Instance & operator=(Instance const &other)
Assignment.
Definition: ExchangeToolkit.h:1661
Provides a wrapper for accessing A3DTess3DData.
Definition: ExchangeToolkit.h:757
A3DEntity * leaf(void) const
Gets the leaf entity pointer.
Definition: ExchangeToolkit.h:1727