Macro para copiar varios pads
Buen día,
Me gustaría ver si alguien me puede ayudar en lo siguiente:
Voy a crear una macro que me permita seleccionar "X" cantidad de pads dentro de un CatPart para luego copiarlas y pegarlas dentro de un Body que yo también seleccionaré...
No se cuales instrucciones utilizar para la selección de diferentes items...
Además, si alguien tiene una lista de las instrucciones y para qué sirven le agradecería mucho que me las pasara...
Saludos,
- Inicie sesión o registrese para enviar comentarios
Re: Macro para copiar varios Pads
Hola chago
Te dejo la ayuda del comando seleciton:
Represents the selection.
+--------+The Selection object contains the features the end user selected, usually with the mouse, and which are candidates as subjects for the next action.
A feature possess parent objects in the specification tree (hierarchy). For example, the Pad below possess parent objects in the specification tree:
!Product3!
+--------+
!
+- Product2 (Product2.1)
! !
! +- Product1 (Product1.1)
! !
! +- Part1 (Part1.1)
! !
! +- Part1
! !
! +- PartBody
! ! +------------------+
! +- Pad.1 ! Selected feature !
! ! +------------------+
! +- Sketch.1
+- Part2 (Part2.1)
For a given selected feature, its parent objects which are exposed to automation can be accessed through a recursive call to the AnyObject.Parentproperty. When a given feature is selected, there are three possibilities:
For example, if the user:
- Puts a DMU Navigator URL in the clipboard
- Runs a script calling the PasteSpecial method
then, during the paste, the DMU Navigator URL will be pastedFor example, if the user:
- Go to the "DPM - Process and Resource Definition" workshop
- Puts a ResourcesList object in the clipboard
- Runs a script calling the Selection.PasteSpecial method
then, during the paste, the ResourcesList object will be pasted.Note: The Selection object can be accessed through the Document.Selection property . However, when the active window contains the tree described above, the Selection object to use is the one associated to the Product3 Document , which can be accessed through the application of the Document.Selection to this document. You will, for example, determine the Selectionobject the following way:
Set ActiveProductDocument = CATIA.ActiveDocumentSet Product3 = ActiveProductDocument.Product
Set Product3Products = Product3.Products
Set Product2Dot1 = Product3Products.Item("Product2.1") : Set Product2 = Product2Dot1.ReferenceProduct
Set ProductDocument2 = Product2.Parent
Set Product2Products = Product2.Products
Set Product1Dot1 = Product2Products.Item("Product1.1") : Set Product1 = Product1Dot1.ReferenceProduct
Set ProductDocument1 = Product1.Parent
Set Product1Products = Product1.Products
Set Part1Dot1 = Product1Products.Item("Part1.1") : Set Part1 = Part1Dot1.ReferenceProduct
Set PartDocument1 = Part1.Parent
Set Selection = ActiveProductDocument.Selection
Another Selectionobject, such as:
Set ProductDocument2Selection = ProductDocument2.SelectionSet ProductDocument1Selection = ProductDocument1.Selection
Set PartDocument1Selection = PartDocument1.Selection
(lets take ProductDocument2Selection for example) can only be used if, among the different Window , there is at least one whose root Document is ProductDocument2 . Otherwise, results are unpredictable.
Re: Macro para copiar varios Pads
Para que la macro se pare y te pida seleccionar un elemento deberia de poner
Dim selection1 As Selection
Set selection1 = CATIA.ActiveDocument.Selection -> definir la selección
Dim oInputType(0)
oInputType(0) = "Product" ->para definir que tipo de elemento quieres seleccionar
Dim oStatus
oStatus = selection1.SelectElement2(oInputType, "Escribir aqui Titulo que parece en la barra de mensajes inferior", False) -> para pedir la selección y que muestre un mensaje
El elemento selecionado se graba la en la variable oStatus
Saludos