////////////////////////////////////////////////////////////////////////////// // // Copyright 2016 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software. // ////////////////////////////////////////////////////////////////////////////// #pragma once #include "../../Core/Base.h" #include "../FusionTypeDefs.h" #include #include // THIS CLASS WILL BE VISIBLE TO AN API CLIENT. // THIS HEADER FILE WILL BE GENERATED FROM NIDL. #include "../../Core/OSMacros.h" #ifdef FUSIONXINTERFACE_EXPORTS # ifdef __COMPILING_ADSK_FUSION_PATTERNELEMENT_CPP__ # define ADSK_FUSION_PATTERNELEMENT_API XI_EXPORT # else # define ADSK_FUSION_PATTERNELEMENT_API # endif #else # define ADSK_FUSION_PATTERNELEMENT_API XI_IMPORT #endif namespace adsk { namespace fusion { class BRepFace; class Feature; class Occurrence; }} namespace adsk { namespace core { class Matrix3D; }} namespace adsk { namespace fusion { /// This class defines the properties that pertain to the pattern element. class PatternElement : public core::Base { public: /// Gets the faces generated as a result of this particular element. std::vector> faces() const; /// Gets the id of this element within the pattern. size_t id() const; /// Gets the feature pattern this element is a member of. core::Ptr parentFeature() const; /// Gets and sets whether the element is suppressed or not. A value of True indicates it is suppressed bool isSuppressed() const; bool isSuppressed(bool value); /// Get the transform that describes this elements relative position to the parent object(s). /// The transform returned for the first element in a pattern will be an identity matrix. core::Ptr transform() const; /// Get the name of the pattern element. std::string name() const; /// If the patternEntityType property of the parent feature returns OccurrencesPatternType /// then this property will return the occurrences associated with this particular pattern /// element. std::vector> occurrences() const; ADSK_FUSION_PATTERNELEMENT_API static const char* classType(); ADSK_FUSION_PATTERNELEMENT_API const char* objectType() const override; ADSK_FUSION_PATTERNELEMENT_API void* queryInterface(const char* id) const override; ADSK_FUSION_PATTERNELEMENT_API static const char* interfaceId() { return classType(); } private: // Raw interface virtual BRepFace** faces_raw(size_t& return_size) const = 0; virtual size_t id_raw() const = 0; virtual Feature* parentFeature_raw() const = 0; virtual bool isSuppressed_raw() const = 0; virtual bool isSuppressed_raw(bool value) = 0; virtual core::Matrix3D* transform_raw() const = 0; virtual char* name_raw() const = 0; virtual Occurrence** occurrences_raw(size_t& return_size) const = 0; }; // Inline wrappers inline std::vector> PatternElement::faces() const { std::vector> res; size_t s; BRepFace** p= faces_raw(s); if(p) { res.assign(p, p+s); core::DeallocateArray(p); } return res; } inline size_t PatternElement::id() const { size_t res = id_raw(); return res; } inline core::Ptr PatternElement::parentFeature() const { core::Ptr res = parentFeature_raw(); return res; } inline bool PatternElement::isSuppressed() const { bool res = isSuppressed_raw(); return res; } inline bool PatternElement::isSuppressed(bool value) { return isSuppressed_raw(value); } inline core::Ptr PatternElement::transform() const { core::Ptr res = transform_raw(); return res; } inline std::string PatternElement::name() const { std::string res; char* p= name_raw(); if (p) { res = p; core::DeallocateArray(p); } return res; } inline std::vector> PatternElement::occurrences() const { std::vector> res; size_t s; Occurrence** p= occurrences_raw(s); if(p) { res.assign(p, p+s); core::DeallocateArray(p); } return res; } }// namespace fusion }// namespace adsk #undef ADSK_FUSION_PATTERNELEMENT_API