
M圓DPartService.PLMCreate “3DPart”, MyEditor3DShape Set M圓DPartService = CATIA.GetSessionService(“PLMNewService”) Set oVPMRoot = oVPMRootOccOnRoot.ReferenceRootOccurrenceOf Set oVPMRootOccOnRoot = oProductRootService.RootOccurrence Set oProductRootService = ActiveEditor1.GetService(“PLMProductService”)ĭim oVPMRootOccOnRoot As VPMRootOccurrence Here is my code:ĭim oProductRootService As PLMProductService I create a new 3D Part then instant under a product.
#AN INTRODUCTION TO CATIA V6 RELEASE 2012 CODE#
I follow example in CATIA V6 Automation Document, but code doesn’t work. Maybe because the database of V6 is different V5. Now I am having a problem with my CATIA V6 macro to insert a new 3D Part under a Product. Thank for your website and email tutorial. OOpenService.PLMOpen cPLMEntities.Item(1), oEditor Set oOpenService = CATIA.GetSessionService ("PLMOpenService") Set cPLMEntities = oPLMSearch.EditedContentDim oOpenService As PLMOpenService OPLMSearch.SearchDim cPLMEntities As PLMEntities OPLMSearch.AddAttributeCriteria "V_version", version OPLMSearch.AddAttributeCriteria "PLM_ExternalID", partNumber OPLMSearch.Type = "ProductDS" 'can be different for your company Set oSearchService = CATIA.GetSessionService ("PLMSearch") If iStream.AtEndOfStream = True Then Exit ForĮnd SubSub OpenProduct (partNumber, version) Set iStream = oFile.OpenAsTextStream ("ForReading")For i = 1 to 100 Set oFile = ("C:\Users\yOuRnAmE\Desktop\PartNumbersTextFile.txt") Dim iStream As TextStream OpenProduct left(partNumbers(i), 15), right(partNumbers(i), 1) Notice how it is the same yet different to a code written for V5? The following code is a CATIA V6 macro that will open parts using a txt file on the desktop. Although, the measure tool and the constraints/mechanism creation are different. The “3D Shape” is what we call the Representation Reference or “Rep. The “3D Part” is equivalent to the CATProduct and CATPart we are used to. The environment where the product is opened is called the “Blue Layer”, basically the place where we are used to work in V5. It has many other applications but to be concise those are the main two. The main purpose of this layer is to allow you to visually choose and open a part, but it can also be used to open specific part(s) within a product that you want for very large assemblies. It allows you see 3D thumbnails of the parts in a sort of turntable organized by the hierarchy. Simply put, it is a new environment that is accessed when you choose to “Explore” a product instead of opening it directly from the search window. The second most noticeable difference is the silver layer. The biggest difference between CATIA V6 and CATIA V5 is that it is server based, therefore it is required to search for a part or product before you can open it. But the skills and knowledge required to write the codes in V5 will transfer to V6 and other programming languages as well. One question I am getting asked more and more is if CATIA V5 macro programming skills are going to be applicable in CATIA V6? My answer is the majority of the macros you write in V5 will not be able to be used in V6 as is. Will programming knowledge in CATIA v5 translate to V6?
