![]() ![]() MsgBox("DONE!!" & unt & " added into " & body1.Welcome to the ultimate (and free) CATIA macro programming guide! Check out some of our additional free articles about writing VBA Catia macros. ShapeFactory1.AddNewAdd (body2).name="ADD_CATIA_MACROS_" & i 'We can set the name for the body on this way and also we will set the name for the add on the same way Set body2 = bodies1.Item(em(i).value.name) 'We want to control this for loop with our multiple selection When you run multiple selection you will get palette for selection.į_Body = oSel.SelectElement3(Filter, "Select Bodies whic you want to add", False, CATMultiSelectionMode.CATMultiSelTriggWhenUserValidatesSelection, False) This is code for multiple selection and you can use it for every multiple selection. ![]() 'This line of code is different, here we now want to select multiple bodies. MsgBox("DONE!!" & body2.name & " added into " & body1.name)į_Body=lectelement2(Filter, " Select Body in whic you want to add", False) ![]() 'You want to display message to inform user that macro is done. Updating only feature is much better option for big models because it takes less time. 'After add you need to update this part, you can also update just feature. If you don't know how to declare it, you can always record macro or you can check in V5Automation.chm file.We will put file for download and picture of it. We need some declaration for that add to. ![]() ' In the end we can add our second body in the first. Set body2 = bodies1.Item(em(1).value.name) When selection is clear we can let user to make selection.į_Body=lectelement2(Filter, " Select Body which you want to add", False) 'Before we want to select our second body we need to clear the selection. Every time you need to define in body you will use this code. ' This first selected body is inworkobject, it means that macro will define in this body. Set body1 = bodies1.Item(em(1).value.name) 'We will use that name from selection to define our first body 'Because we work with bodies, we need to define them You just need to remember or write it downį_Body=lectelement2(Filter, " Select Body in which you want to add", False) 'In next line of code is code for single selection, also this code is always the same. 'We want to set filter for that selection so user can only select part, this is very good practice to do 'First you need to define document, in this case active document is part. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |