{"id":11617,"date":"2022-09-10T12:02:59","date_gmt":"2022-09-10T10:02:59","guid":{"rendered":"https:\/\/cadbooster.com\/?p=11617"},"modified":"2024-03-16T13:40:32","modified_gmt":"2024-03-16T12:40:32","slug":"entities-and-getcorresponding-in-the-solidworks-api","status":"publish","type":"post","link":"https:\/\/cadbooster.com\/nl\/entities-and-getcorresponding-in-the-solidworks-api\/","title":{"rendered":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)"},"content":{"rendered":"<h3>In this blog post, you&#8217;ll find<\/h3>\n<ol>\n<li><a href=\"#what-are-entities\">What are entities?<\/a>\n<ol>\n<li><a href=\"#all-interfaces-that-implement-ientity\">All interfaces that implement IEntity<\/a><\/li>\n<li><a href=\"#what-are-loops\">What are loops?<\/a><\/li>\n<li><a href=\"#what-are-features\">What are features?<\/a><\/li>\n<li><a href=\"#casting-to-and-from-entities\">Casting to and from entities<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#entities-and-their-persistent-reference-id\">Entities and their Persistent Reference ID<\/a><\/li>\n<li><a href=\"#how-to-get-an-entity-s-object\">How to get an entity&#8217;s object<\/a><\/li>\n<li><a href=\"#how-to-select-a-vertex-face-or-edge-via-its-entity\">How to select a vertex, face or edge: via its entity<\/a><\/li>\n<li><a href=\"#what-are-safe-entities\">What are Safe Entities?<\/a><\/li>\n<li><a href=\"#how-to-assign-an-attribute-to-an-entity\">How to assign an attribute to an entity<\/a>\n<ol>\n<li><a href=\"#what-are-attributes\">What are attributes?<\/a><\/li>\n<li><a href=\"#parameter-types-within-attributes\">Parameter types within attributes<\/a><\/li>\n<li><a href=\"#how-to-create-an-attribute\">How to create an attribute<\/a><\/li>\n<li><a href=\"#how-to-retrieve-an-attribute-from-an-entity\">How to retrieve an attribute from an entity<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#understanding-the-scope-of-an-entity-does-it-belong-to-a-part-or-a-component\">Understanding the scope of an entity: does it belong to a part or a component?<\/a>\n<ol>\n<li><a href=\"#models-versus-components\">Models versus components<\/a><\/li>\n<li><a href=\"#drawing-components\">Drawing components<\/a><\/li>\n<li><a href=\"#an-entity-is-only-valid-in-the-current-model\">An entity is only valid in the current model<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#how-to-use-getcorresponding-to-get-a-part-entity-in-an-assembly\">How to use GetCorresponding to get a part entity in an assembly<\/a>\n<ol>\n<li><a href=\"#how-to-convert-a-part-entity-to-a-component-entity\">How to convert a part entity to a component entity<\/a><\/li>\n<li><a href=\"#how-to-convert-a-component-entity-to-a-part-entity\">How to convert a component entity to a part entity<\/a><\/li>\n<li><a href=\"#how-to-get-an-entity-in-a-drawing-view-from-a-part-entity\">How to get an entity in a drawing view from a part entity<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#all-blog-posts-in-this-series\">All blog posts in this series<\/a><\/li>\n<\/ol>\n<h3 id=\"what-are-entities\" class=\"anchor\">1. What are entities?<\/h3>\n<p>Every 3D model is built up from vertices (points), edges and faces. In the SOLIDWORKS API, we name these objects <em>Entities<\/em>. They all implement the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity.html\">IEntity<\/a> interface because they share common properties and methods.<\/p>\n<h4 id=\"all-interfaces-that-implement-ientity\" class=\"anchor\">1.1. All interfaces that implement IEntity<\/h4>\n<p>This is the complete list of all interfaces that implement IEntity:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-11633\" src=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-01-interfaces-that-implement-IEntity.png\" alt=\"interfaces that implement IEntity\" width=\"1026\" height=\"701\" srcset=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-01-interfaces-that-implement-IEntity.png 1026w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-01-interfaces-that-implement-IEntity-300x205.png 300w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-01-interfaces-that-implement-IEntity-1024x700.png 1024w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-01-interfaces-that-implement-IEntity-768x525.png 768w\" sizes=\"(max-width: 1026px) 100vw, 1026px\" \/><\/p>\n<p>I think these five objects are the building blocks of geometry:<\/p>\n<ol>\n<li>Vertices\/points are the smallest building blocks: <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.IVertex.html\">IVertex<\/a><\/li>\n<li>Two vertices create a straight edge: <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.IEdge.html\">IEdge<\/a><\/li>\n<li>One or more edges or vertices make up a loop: <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.ILoop2.html\">ILoop2<\/a><\/li>\n<li>One or more loops make up a face: <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.IFace2.html\">IFace2<\/a><\/li>\n<li>One or more faces create a feature: <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.IFeature.html\">IFeature<\/a><\/li>\n<\/ol>\n<p>I don&#8217;t fully understand why loops and features are in the list of entities yet. And because the SOLIDWORKS API docs never explain what an object <strong>is<\/strong>, just what it <strong>does<\/strong>, we&#8217;ll have to figure that out ourselves. This is how I understand it now:<\/p>\n<h4 id=\"what-are-loops\" class=\"anchor\">1.2. What are loops?<\/h4>\n<p>I haven&#8217;t used ILoop2 in my six years of SOLIDWORKS programming, so you probably won&#8217;t need them unless you are creating your own geometry. But from what I have read, SOLIDWORKS creates loops from a list of edges and\/or vertices. Even one vertex can make up a loop.<\/p>\n<p>So they create loops from edges and vertices, then create faces from these loops. Every face has at least one loop, but it can have more than one. A face with two holes in it has three loops, one being the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ILoop2~IsOuter.html\">outer loop<\/a>.<\/p>\n<h4 id=\"what-are-features\" class=\"anchor\">1.3. What are features?<\/h4>\n<p>I have only looked at features as the items in the feature tree. But I think features are included in the list of entities because a feature might <em>create<\/em> a bunch of faces. An extruded circle creates three faces, for example. And when you call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeature~GetFaces.html\">IFeature.GetFaces<\/a> on a draft feature, SOLIDWORKS returns an empty array because a draft feature creates no new faces.<\/p>\n<p>According to the SOLIDWORKS Object Model PDF, that you can <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SWObjectModel.pdf\">download here<\/a>, IFeature doesn&#8217;t even implement IEntity. But I think that is a mistake in the docs.<\/p>\n<h4 id=\"casting-to-and-from-entities\" class=\"anchor\">1.4. Casting to and from entities<\/h4>\n<p>Because all the interfaces above implement IEntity, you can cast (aka convert) the detailed object back to an entity to make use of <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEdge_members.html\">IEntity properties and methods<\/a> (aka members). In VBA:<\/p>\n<pre class=\"lang:vb decode:true\">dim swFace as Face2\r\nset swFace = something 'Get the face from somewhere\r\n\r\ndim swEntity as Entity\r\nset swEntity = swFace 'This is called casting the face to an entity. This works because IFace2 implements IEntity\r\n\r\ndim selected as Boolean\r\nselected = swEntity.Select4(false, Nothing) 'This works in VBA and C#\r\n\r\n'Alternative method: call the Entity method directly\r\nselected = swFace.Select4(false, Nothing) 'This works in VBA, although it does not compile. It also doesn't compile in C# because IFace2 has no Select4 method.<\/pre>\n<p>You can also cast an Entity to a Face2 to use all the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFace2_members.html\">members in IFace2<\/a>, but you have to make sure the entity is actually a face by calling <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity~GetType.html\">IEntity.GetType<\/a> first.<\/p>\n<p>In C#, you have to make explicit casts when casting to and from entities:<\/p>\n<pre class=\"lang:c# decode:true\">IEntity entity = x; \/\/get an entity from somewhere\r\nvar face = (Face2) entity; \/\/ cast an entity to a face\r\nvar entity2 = (IEntity) face; \/\/ cast a face to an entity\r\nvar entity3 = face as IEntity; \/\/ also works<\/pre>\n<p>Normally, when working in C#, you can cast implicitly when a type implements an interface. But the SOLIDWORKS API is different, and they talk about it <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapiprogguide\/gettingstarted\/understanding_the_solidworks_api_class_hierarchy.htm\">here<\/a>. I still don&#8217;t fully understand their explanation because they are talking about three programming languages in one post. My main takeaway is that SOLIDWORKS isn&#8217;t written in C# and inheritance works differently in C++ (I think it&#8217;s written in C++, at least). That is also why we have to use Interop (interoperability) DLLs to talk to SOLIDWORKS.<\/p>\n<h3 id=\"entities-and-their-persistent-reference-id\" class=\"anchor\">2. Entities and their Persistent Reference ID<\/h3>\n<p>All selectable objects in the SOLIDWORKS API have a\u00a0<em>Persistent Reference ID<\/em>. I call them Persistent IDs for short. I explain them in detail in <a href=\"https:\/\/cadbooster.com\/persistent-id-sketch-segment-id-in-the-solidworks-api\/\">Persistent ID, sketch segment ID in the SOLIDWORKS API<\/a> and I keep a list of all available ID types in <a href=\"https:\/\/cadbooster.com\/all-identifiers-and-ids-in-the-solidworks-api\/\">All identifiers and IDs in the SOLIDWORKS API<\/a>.<\/p>\n<p>Names of features, faces and edges are great, but users can often change them. So we need an ID that stays the same, that is\u00a0<em>persistent<\/em>. That&#8217;s when the Persistent ID comes into play. It consists of an array of bytes (so numbers of zero to 255) with a length of 16 (sometimes), 20 (often) or way more, like 491 bytes (occasionally). An example:<\/p>\n<blockquote><p>176-054-000-000-003-000-000-000-255-254-255-000-000-000-000-255<\/p><\/blockquote>\n<p>You can store the persistent ID in a variable so that you can retrieve that object again at a later time. You can&#8217;t trust it 100%, though. To quote myself from my blog post about IDs:<\/p>\n<blockquote><p>Each ID value is unique within a model and it generally stays the same, even across SOLIDWORKS sessions. There is a <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.interop.sldworks~SolidWorks.interop.sldworks.IModelDocExtension~GetPersistReference3.html\">remark<\/a> in the docs, though, that it can change with rebuilds, but I don\u2019t remember that actually becoming a problem in my software.<\/p><\/blockquote>\n<h3 id=\"how-to-get-an-entity-s-object\" class=\"anchor\">3. How to get an entity&#8217;s object<\/h3>\n<ul>\n<li>When a user has selected an item, you can get that object via \u00a0<a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectionMgr~GetSelectedObject6.html\">SelectionManager.GetSelectedObject6<\/a>.<\/li>\n<li>When you already know the persistent ID, you can get the object by calling \u00a0<a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/solidworks.interop.sldworks~solidworks.interop.sldworks.imodeldocextension~getobjectbypersistreference3.html\">ModelDocExtension.GetObjectByPersistReference3<\/a>.\n<ul>\n<li>Both of these methods will not return an Entity object directly but will return the more detailed object: a face, feature, vertex or edge.<\/li>\n<\/ul>\n<\/li>\n<li>If you work with a part and you know the name of the entity, you can use <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.IPartDoc~GetEntityByName.html\">PartDoc.GetEntityByName<\/a>.\n<ul>\n<li>I only use this method to get features, though, because it looks like a feature is the only entity type with a name.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>For a complete list of ways to access an entity, check out the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity.html\">Accessors list<\/a> on the IEntity page.<\/p>\n<h3 id=\"how-to-select-a-vertex-face-or-edge-via-its-entity\" class=\"anchor\">4. How to select a vertex, face or edge: via its entity<\/h3>\n<p>If you don&#8217;t understand entities, you&#8217;re going to have a hard time selecting them. Because IFeature is the only interface that has its own <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeature~Select2.html\">Select2<\/a> method.<\/p>\n<p>For all other entity types, you need to cast the object to an entity, then call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity~Select4.html\">IEntity.Select4<\/a>. You can pass null as an argument for the SelectData when you are doing simple selection work. If you want to set a mark, you need to pass a <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISelectData_members.html\">SelectData<\/a> object.<\/p>\n<h3 id=\"what-are-safe-entities\" class=\"anchor\">5. What are Safe Entities?<\/h3>\n<p>An entity might not exist after a rebuild, as it is <a href=\"https:\/\/www.merriam-webster.com\/dictionary\/transient\">transient<\/a>, short-lived. Just as a persistent ID may not always survive a rebuild.<\/p>\n<p><em>Safe<\/em>\u00a0<em>Entities<\/em> do survive, though. So if you have an entity, need to call a rebuild and want to use that entity again, you need to get a safe entity via <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.IEntity~GetSafeEntity.html\">IEntity.GetSafeEntity<\/a>. This returns a new entity object that will remain valid until you delete all pointers\/references to the object. A safe entity does not persist between SOLIDWORKS sessions, though.<\/p>\n<div style=\"margin: 40px 0; text-align: center; display: block; background-color: #f8f8f8; user-select: none; justify-content: center; border: 3px solid #2ac819; border-radius: 5px;\">\r\n<h2 style=\"color: #363636; font-size: 45px; margin: 20px 0 0 0;\">Ditch the Toolbox, once and for all<\/h2>\r\n<span class=\"subtitle\">Start using the fastener library that actually follows the standards<\/span>\r\n<div style=\"margin: 20px;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-12394\" src=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2023\/02\/Fastener-models-banner-1000x114-1.png\" alt=\"\" width=\"800\" height=\"91\" srcset=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2023\/02\/Fastener-models-banner-1000x114-1.png 1000w, https:\/\/cadbooster.com\/wp-content\/uploads\/2023\/02\/Fastener-models-banner-1000x114-1-300x34.png 300w, https:\/\/cadbooster.com\/wp-content\/uploads\/2023\/02\/Fastener-models-banner-1000x114-1-768x88.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/div>\r\n<div style=\"display: flex; flex-direction: row; padding: 10px;\">\r\n<div style=\"width: 33%; display: flex; justify-content: center;\">\r\n<ul class=\"check check_fastener_models\" style=\"color: #363636; text-align: left; margin-bottom: 0px;\">\r\n<li>No more mate errors<\/li>\r\n<\/ul>\r\n<\/div>\r\n<div style=\"width: 33%; display: flex; justify-content: center;\">\r\n<ul class=\"check check_fastener_models\" style=\"color: #363636; text-align: left; margin-bottom: 0px;\">\r\n<li>Made for speed<\/li>\r\n<\/ul>\r\n<\/div>\r\n<div style=\"width: 33%; display: flex; justify-content: center;\">\r\n<ul class=\"check check_fastener_models\" style=\"color: #363636; text-align: left; margin-bottom: 0px;\">\r\n<li>No yearly license fees<\/li>\r\n<\/ul>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin-bottom: 20px;\"><a id=\"drew-banner-confirm\" class=\" shortcode_button btn_small btn_type1 fastener_models_button\" href=\"\/fastener-models\/\" target=\"_blank\" rel=\"noopener noreferrer\">Show me how<\/a><\/div>\r\n<\/div>\n<h3 id=\"how-to-assign-an-attribute-to-an-entity\" class=\"anchor\">6. How to assign an attribute to an entity<\/h3>\n<h4 id=\"what-are-attributes\" class=\"anchor\">6.1. What are attributes?<\/h4>\n<p>You can attach data to any entity, and we do that via <em>attributes<\/em>. Attributes are features, so they appear in the feature tree unless you explicitly hide them. They have a name and can even be suppressed.<\/p>\n<p>Attributes can be added to:<\/p>\n<ol>\n<li>Bodies<\/li>\n<li>Components<\/li>\n<li>Entities<\/li>\n<li>Models<\/li>\n<\/ol>\n<p>We add an attribute to the active model in our <a href=\"https:\/\/cadbooster.com\/solidworks-add-in\/drew\/\">drawing automation add-in Drew<\/a> to store two strings with extra data.<\/p>\n<h4 id=\"parameter-types-within-attributes\" class=\"anchor\">6.2. Parameter types within attributes<\/h4>\n<p>You can add multiple <em>Parameters\u00a0<\/em>to an attribute, and a parameter can be any of the following <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/swconst\/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swParamType_e.html\">parameter types<\/a>:<\/p>\n<ol>\n<li>Double<\/li>\n<li>DVector (double vector, maybe?)<\/li>\n<li>Integer<\/li>\n<li>String<\/li>\n<\/ol>\n<p>Only basic variable types, essentially. If you create a double, you can even set a default value. There are some <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IAttributeDef~AddParameter.html\">weird quirks<\/a>, though, like not being able to store a negative integer value.<\/p>\n<h4 id=\"how-to-create-an-attribute\" class=\"anchor\">6.3. How to create an attribute<\/h4>\n<p>Attributes are special objects, it seems. So, to create an attribute, you need to jump through some hoops:<\/p>\n<ol>\n<li>Call ISldWorks.DefineAttribute once in a session to create an\u00a0<em>Attribute Definition<\/em>.\n<ul>\n<li>Every attribute name needs to be unique. So if you are planning to use an attribute in a product, you need to register your own prefix with the SOLIDWORKS team.<\/li>\n<li>According to the docs, the prefix needs to be three letters long. The one we got assigned is four letters, though \ud83d\ude05<\/li>\n<li>Store this definition somewhere in your running project because you&#8217;ll need it to create instances later.<\/li>\n<\/ul>\n<\/li>\n<li>You call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IAttributeDef~AddParameter.html\">AddParameter<\/a> on the attribute definition to add one or more parameters.<\/li>\n<li>You register the attribute definition by calling <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.IAttributeDef~Register.html\">IAttributeDef.Register<\/a>.\n<ul>\n<li>The definition is now final. You cannot add any parameters after the fact.<\/li>\n<\/ul>\n<\/li>\n<li>Only now, you can start creating instances by calling <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.IAttributeDef~CreateInstance5.html\">IAttributeDef.CreateInstance5<\/a>.\n<ul>\n<li>You pass the entity that the attribute definition should attach to as a parameter here.<\/li>\n<li>If you want to hide or suppress the attribute, you can pass those settings as parameters as well.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4 id=\"how-to-retrieve-an-attribute-from-an-entity\" class=\"anchor\">6.4. How to retrieve an attribute from an entity<\/h4>\n<p>Because attributes are features, you can retrieve them in similar ways:<\/p>\n<ol>\n<li>By traversing the feature tree, checking the feature type, then calling <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/solidworks.interop.sldworks~solidworks.interop.sldworks.ifeature~getspecificfeature2.html\">IFeature.GetSpecificFeature2<\/a> to get the Attribute.<\/li>\n<li>By letting the user select the attribute feature, then using <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.ISelectionMgr~GetSelectedObject6.html\">GetSelectedObject6<\/a> to get the feature object.<\/li>\n<li>By calling <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IPartDoc~FeatureByName.html\">IPart.IFeatureByName<\/a>, <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IAssemblyDoc~FeatureByName.html\">IAssembly.IFeatureByName<\/a> or <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IDrawingDoc~FeatureByName.html\">IDrawing.IFeatureByName<\/a>.\n<ul>\n<li>I don&#8217;t know why they haven&#8217;t just added this method to IModelDoc.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>If you already have an entity object, you can call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity~FindAttribute.html\">IEntity.FindAttribute<\/a> directly. A few caveats, though:<\/p>\n<ul>\n<li>Apparently, an entity can have multiple attributes attached to it. That is why the FindAttribute method also has an argument for a number, to get the <em>n<\/em>th attribute.<\/li>\n<li>I have not found a way to find out how many attributes are attached to an entity, though.<\/li>\n<\/ul>\n<h3 id=\"understanding-the-scope-of-an-entity-does-it-belong-to-a-part-or-a-component\" class=\"anchor\">7. Understanding the scope of an entity: does it belong to a part or a component?<\/h3>\n<p>You have to understand the scope of entities. Because you cannot just get an entity from a part, then try to use it again while the part is in an assembly. That entity does not exist there.<\/p>\n<h4 id=\"models-versus-components\" class=\"anchor\">7.1. Models versus components<\/h4>\n<p>Models are basically documents, files. A model can be a part, assembly or drawing document and it is represented by <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDoc2_members.html\">IModelDoc2<\/a>. These models can create geometry from scratch:<\/p>\n<ol>\n<li>A part contains features that create new faces and bodies<\/li>\n<li>An assembly can have holes at the assembly level, so it can create some new faces<\/li>\n<li><a href=\"https:\/\/cadbooster.com\/drawings-assemblies-mind-blown\/\">Drawings are secretly assemblies<\/a>, and I think SOLIDWORKS creates cross-section views by just creating a cut-extrude, which is why cross-sections can give you zero-thickness errors. So even drawings create new geometry.<\/li>\n<\/ol>\n<p>But once you add a part to an assembly, we call it a\u00a0<em>component<\/em> and the API represents it as <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IComponent2_members.html\">IComponent2<\/a>. You can access the underlying model via <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IComponent2~GetModelDoc2.html\">IComponent2.GetModelDoc2<\/a>. Be careful, though, because this returns null when the component is suppressed or when it is loaded as <em>lightweight<\/em>. So if you need access to all models in an assembly, you first need to call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IAssemblyDoc~ResolveAllLightWeightComponents.html\">IAssemblyDoc.ResolveAllLightweightComponents<\/a>.<\/p>\n<p>The assembly itself is called the\u00a0<em>root component<\/em> and the other components are its <em>children<\/em>. Each child can have its own children. This structure creates the tree of parts and (sub)assemblies that you see in the feature tree.<\/p>\n<p>Since you can have multiple instances of the same part, each component has its own geometry and its own entities. Because an assembly-level hole should not appear in every part instance.<\/p>\n<h4 id=\"drawing-components\" class=\"anchor\">7.2. Drawing components<\/h4>\n<p>Since drawings are secretly assemblies, every view creates its own instance of the model you are showing. So that creates even more geometry. To bridge the gap between assemblies and drawings, the SOLIDWORKS API has the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/solidworks.interop.sldworks~solidworks.interop.sldworks.idrawingcomponent.html\">IDrawingComponent<\/a> interface. You can get the visible drawing components in a view with <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IView~GetVisibleDrawingComponents.html\">IView.GetVisibleDrawingComponents<\/a> and you can get the underlying Component2 object via <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IDrawingComponent~Component.html\">IDrawingComponent.Component<\/a>.<\/p>\n<p>Unless you are doing fancy stuff with drawings, you will not need drawing components. Even in Drew, I hardly use them. I had been making add-ins for years before I discovered them \ud83d\ude04<\/p>\n<h4 id=\"an-entity-is-only-valid-in-the-current-model\" class=\"anchor\">7.3. An entity is only valid in the current model<\/h4>\n<p>This all leads up to an important conclusion: an entity is only valid in a certain\u00a0<em>context<\/em>. A part entity only works within that part and an assembly entity only works within that assembly.<\/p>\n<p>If you let a user select a part face in an assembly, you cannot use that entity directly to select a face when you have the part open. But you can convert them! I&#8217;ll explain that now.<\/p>\n<h3 id=\"how-to-use-getcorresponding-to-get-a-part-entity-in-an-assembly\" class=\"anchor\">8. How to use GetCorresponding to get a part entity in an assembly<\/h3>\n<h4 id=\"how-to-convert-a-part-entity-to-a-component-entity\" class=\"anchor\">8.1. How to convert a part entity to a component entity<\/h4>\n<p>Say you create a part and you want to use reference a face when this part is used in an assembly. You select a face and get the selected object, you don&#8217;t need to use the underlying entity. This all happens in the <em>Model Context<\/em>.<\/p>\n<p>Now switch to an assembly that contains this part. We&#8217;re now working in the\u00a0<em>Assembly Context<\/em>. To request the same face, you call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/solidworks.interop.sldworks~solidworks.interop.sldworks.icomponent2~getcorresponding.html\">IComponent2.GetCorresponding2<\/a> on the assembly component and pass the part&#8217;s face as an argument. This method returns a new face that belongs to the assembly context, or null if the input was incorrect. You can test it by calling the <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IEntity~Select4.html\">Select4<\/a> method because that method only selects the face if the context is correct.<\/p>\n<p>This method works on any object with a persistent ID, by the way, so not just entities.<\/p>\n<h4 id=\"how-to-convert-a-component-entity-to-a-part-entity\" class=\"anchor\">8.2. How to convert a component entity to a part entity<\/h4>\n<p>If you have a face that belongs to a component and you want to get the face that belongs to the underlying part, you need to call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~GetCorresponding2.html\">IModelDocExtension.GetCorresponding<\/a> on the part&#8217;s model extension and pass the component face as an argument. You have now gone from the assembly context to the model context.<\/p>\n<p>This method also lets you convert a face in a drawing view to a part face.<\/p>\n<div id=\"attachment_11636\" style=\"width: 1348px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-11636\" class=\"size-full wp-image-11636\" src=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-02-assembly-and-model-context.png\" alt=\"assembly and model context\" width=\"1338\" height=\"899\" srcset=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-02-assembly-and-model-context.png 1338w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-02-assembly-and-model-context-300x202.png 300w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-02-assembly-and-model-context-1024x688.png 1024w, https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-02-assembly-and-model-context-768x516.png 768w\" sizes=\"(max-width: 1338px) 100vw, 1338px\" \/><p id=\"caption-attachment-11636\" class=\"wp-caption-text\">How to go from part context to assembly context (right to left) and the other way around. Source: CodeStack.net<\/p><\/div>\n<h4 id=\"how-to-get-an-entity-in-a-drawing-view-from-a-part-entity\" class=\"anchor\">8.3. How to get an entity in a drawing view from a part entity<\/h4>\n<p>If you have a face that belongs to a part and you want to use it in a drawing view, you call <a href=\"https:\/\/help.solidworks.com\/2022\/english\/api\/sldworksapi\/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IView~GetCorresponding.html\">IView.GetCorresponding<\/a> and pass the part face as an argument.<\/p>\n<p>To learn more about these contexts, CodeStack also has a blog post about <a href=\"https:\/\/www.codestack.net\/solidworks-api\/document\/assembly\/context\/\">assembly context<\/a> with a few API examples.<\/p>\n<h3 id=\"all-blog-posts-in-this-series\" class=\"anchor\">All blog posts in this series<\/h3>\r\n<ol>\r\n<li><a href=\"\/the-solidworks-object-model-api-explained-part-1\/\">The SOLIDWORKS Object Model + API explained<\/a><\/li>\r\n<li><a href=\"\/solidworks-api-basics-sldworks-modeldoc2\/\">SOLIDWORKS API: the basics - SldWorks, ModelDoc2<\/a><\/li>\r\n<li><a href=\"\/how-to-work-with-features-in-the-solidworks-api\/\">How to work with Features\u00a0<\/a><\/li>\r\n<li><a href=\"\/persistent-id-sketch-segment-id-in-the-solidworks-api\/\">Persistent ID and sketch segment ID and more<\/a><\/li>\r\n<li><a href=\"\/all-identifiers-and-ids-in-the-solidworks-api\/\">All identifiers in the SOLIDWORKS API<\/a><\/li>\r\n<li><a href=\"\/about-return-values-in-the-solidworks-api-part-6\/\">About return values<\/a><\/li>\r\n<li><a href=\"\/entities-and-getcorresponding-in-the-solidworks-api\/\">Entities and GetCorresponding<\/a><\/li>\r\n<li><a href=\"\/how-to-work-with-selections-in-the-solidworks-api\/\">How to work with selections<\/a><\/li>\r\n<li><a href=\"\/how-to-use-custom-properties-in-the-solidworks-api\/\">How to use custom properties<\/a><\/li>\r\n<li><a href=\"\/understanding-math-and-mathtransform-in-the-solidworks-api\">Understanding math and MathTransform<\/a><\/li>\r\n<li>Toolbars, menus and the Command Manager<\/li>\r\n<li>How to create task panes and Property Manager Pages<\/li>\r\n<li>How to develop a SOLIDWORKS add-in<\/li>\r\n<li>SolidDNA: a better framework for SOLIDWORKS add-ins<\/li>\r\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them here.<\/p>\n","protected":false},"author":6,"featured_media":11642,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[214],"tags":[240,570,569,571,276,396],"class_list":["post-11617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solidworks-macros-en","tag-api","tag-components","tag-getcorresponding","tag-ientity","tag-macro","tag-persistent-id"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.1 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Entities and GetCorresponding in the SOLIDWORKS API (part 7)<\/title>\n<meta name=\"description\" content=\"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/\" \/>\n<meta property=\"og:locale\" content=\"nl_NL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Entities and GetCorresponding in the SOLIDWORKS API (part 7)\" \/>\n<meta property=\"og:description\" content=\"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/\" \/>\n<meta property=\"og:site_name\" content=\"CAD Booster\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-10T10:02:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-16T12:40:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1170\" \/>\n\t<meta property=\"og:image:height\" content=\"830\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Peter Brinkhuis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Geschreven door\" \/>\n\t<meta name=\"twitter:data1\" content=\"Peter Brinkhuis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Geschatte leestijd\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/\"},\"author\":{\"name\":\"Peter Brinkhuis\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#\\\/schema\\\/person\\\/3e38034e2c654d4589df4fceba30b2ed\"},\"headline\":\"Entities and GetCorresponding in the SOLIDWORKS API (part 7)\",\"datePublished\":\"2022-09-10T10:02:59+00:00\",\"dateModified\":\"2024-03-16T12:40:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/\"},\"wordCount\":2463,\"publisher\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg\",\"keywords\":[\"API\",\"components\",\"GetCorresponding\",\"IEntity\",\"macro\",\"persistent id\"],\"articleSection\":[\"API \\\/ macros\"],\"inLanguage\":\"nl-NL\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/\",\"url\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/\",\"name\":\"Entities and GetCorresponding in the SOLIDWORKS API (part 7)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg\",\"datePublished\":\"2022-09-10T10:02:59+00:00\",\"dateModified\":\"2024-03-16T12:40:32+00:00\",\"description\":\"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#breadcrumb\"},\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg\",\"contentUrl\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg\",\"width\":1170,\"height\":830,\"caption\":\"solidworks api how entities, faces and GetCorresponding\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/entities-and-getcorresponding-in-the-solidworks-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/cadbooster.com\\\/nl\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entities and GetCorresponding in the SOLIDWORKS API (part 7)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#website\",\"url\":\"https:\\\/\\\/cadbooster.com\\\/\",\"name\":\"CAD Booster\",\"description\":\"SOLIDWORKS AUTOMATION\",\"publisher\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cadbooster.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nl-NL\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#organization\",\"name\":\"CAD Booster\",\"url\":\"https:\\\/\\\/cadbooster.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2016\\\/11\\\/logo-CAD-Booster.png\",\"contentUrl\":\"https:\\\/\\\/cadbooster.com\\\/wp-content\\\/uploads\\\/2016\\\/11\\\/logo-CAD-Booster.png\",\"width\":1732,\"height\":964,\"caption\":\"CAD Booster\"},\"image\":{\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cadbooster.com\\\/#\\\/schema\\\/person\\\/3e38034e2c654d4589df4fceba30b2ed\",\"name\":\"Peter Brinkhuis\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)","description":"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/","og_locale":"nl_NL","og_type":"article","og_title":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)","og_description":"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.","og_url":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/","og_site_name":"CAD Booster","article_published_time":"2022-09-10T10:02:59+00:00","article_modified_time":"2024-03-16T12:40:32+00:00","og_image":[{"width":1170,"height":830,"url":"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg","type":"image\/jpeg"}],"author":"Peter Brinkhuis","twitter_card":"summary_large_image","twitter_misc":{"Geschreven door":"Peter Brinkhuis","Geschatte leestijd":"11 minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#article","isPartOf":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/"},"author":{"name":"Peter Brinkhuis","@id":"https:\/\/cadbooster.com\/#\/schema\/person\/3e38034e2c654d4589df4fceba30b2ed"},"headline":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)","datePublished":"2022-09-10T10:02:59+00:00","dateModified":"2024-03-16T12:40:32+00:00","mainEntityOfPage":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/"},"wordCount":2463,"publisher":{"@id":"https:\/\/cadbooster.com\/#organization"},"image":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#primaryimage"},"thumbnailUrl":"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg","keywords":["API","components","GetCorresponding","IEntity","macro","persistent id"],"articleSection":["API \/ macros"],"inLanguage":"nl-NL"},{"@type":"WebPage","@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/","url":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/","name":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)","isPartOf":{"@id":"https:\/\/cadbooster.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#primaryimage"},"image":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#primaryimage"},"thumbnailUrl":"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg","datePublished":"2022-09-10T10:02:59+00:00","dateModified":"2024-03-16T12:40:32+00:00","description":"SOLIDWORKS geometry is built up from entities: points, edges + faces. We explain them and how to switch between part and assembly contexts.","breadcrumb":{"@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#breadcrumb"},"inLanguage":"nl-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/"]}]},{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#primaryimage","url":"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg","contentUrl":"https:\/\/cadbooster.com\/wp-content\/uploads\/2022\/09\/092-00-solidworks-api-how-entities-faces-and-GetCorresponding.jpg","width":1170,"height":830,"caption":"solidworks api how entities, faces and GetCorresponding"},{"@type":"BreadcrumbList","@id":"https:\/\/cadbooster.com\/entities-and-getcorresponding-in-the-solidworks-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cadbooster.com\/nl\/"},{"@type":"ListItem","position":2,"name":"Entities and GetCorresponding in the SOLIDWORKS API (part 7)"}]},{"@type":"WebSite","@id":"https:\/\/cadbooster.com\/#website","url":"https:\/\/cadbooster.com\/","name":"CAD Booster","description":"SOLIDWORKS AUTOMATION","publisher":{"@id":"https:\/\/cadbooster.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cadbooster.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nl-NL"},{"@type":"Organization","@id":"https:\/\/cadbooster.com\/#organization","name":"CAD Booster","url":"https:\/\/cadbooster.com\/","logo":{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/cadbooster.com\/#\/schema\/logo\/image\/","url":"https:\/\/cadbooster.com\/wp-content\/uploads\/2016\/11\/logo-CAD-Booster.png","contentUrl":"https:\/\/cadbooster.com\/wp-content\/uploads\/2016\/11\/logo-CAD-Booster.png","width":1732,"height":964,"caption":"CAD Booster"},"image":{"@id":"https:\/\/cadbooster.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cadbooster.com\/#\/schema\/person\/3e38034e2c654d4589df4fceba30b2ed","name":"Peter Brinkhuis"}]}},"_links":{"self":[{"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/posts\/11617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/comments?post=11617"}],"version-history":[{"count":6,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/posts\/11617\/revisions"}],"predecessor-version":[{"id":13819,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/posts\/11617\/revisions\/13819"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/media\/11642"}],"wp:attachment":[{"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/media?parent=11617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/categories?post=11617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cadbooster.com\/nl\/wp-json\/wp\/v2\/tags?post=11617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}