Array of Parts according to selection
Array of Parts according to selection
(OP)
CODE --> CATVBS
Sub CATMain() Dim ArrayOfParts() 'As Object Dim ArrayOfParts_size 'As Integer Dim SelectedPart 'As Object Dim PartFilt(0) Set ProdDoc1 = CATIA.ActiveDocument Set SelectedParts = ProdDoc1.Selection PartFilt(0) = "Part" Dim ret ArrayOfParts_size = -1 SelectedParts.Clear ret = SelectedParts.SelectElement2(PartFilt, "Select Part", False) ArrayOfParts_size = ArrayOfParts_size + 1 ReDim Preserve ArrayOfParts(ArrayOfParts_size) MsgBox TypeName(SelectedParts.Item(1).Value) MsgBox ArrayOfParts_size ArrayOfParts(ArrayOfParts_size) = SelectedParts.Item(1).Value End Sub
Hello everyone
I've got problem with filling array of parts -see code below.
Macro stops at error on line:
ArrayOfParts(ArrayOfParts_size) = SelectedParts.Item(1).Value
"Object doesn't support this property or method"
is it even possible to create array of Part object's type?
LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013





RE: Array of Parts according to selection
CODE -->
Sometimes You are not smart enough to find such dummy mistake
LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
RE: Array of Parts according to selection
I am having trouble getting my macro to Activate a node in the tree so that I can edit it. Any ideas?
RE: Array of Parts according to selection
ActiveSel.Add cattree.Products.Item(i) 'Selects My product
CATIA.StartCommand "Expand Selection"
SendKeys "1"
SendKeys "~"
doesn't work
This also doesn't work:
ActiveSel.Add cattree.Products.Item(i) 'Select VSYS_CHASSIS product
CATIA.StartCommand "Expand Selection"
hwndButtonOK = FindWindowEx(hwndExpSel, 0, "Button", "OK") 'Get handle to OK button
Foc = Putfocus(hwndExpTextbox) 'Put cursor in "Expand Selection" textbox
'SendKeys "1", True 'Choose single level expansion
lResult = SendMessage(hwndButtonOK, BM_CLICK, 0, 0) 'Press OK button
RE: Array of Parts according to selection
CODE -->
And D:\sendKeys.vbs code:
CODE -->
Set WshShell = WScript.CreateObject("WScript.Shell") WScript.sleep 200 WshShell.SendKeys "c:Expand Selection" + "{ENTER}", True WScript.sleep 200 WshShell.SendKeys "4", True WScript.sleep 200 WshShell.SendKeys "{ENTER}",TrueWorks well to me
Before You run macro, please select any object from tree
LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
RE: Array of Parts according to selection
I am writing in catvba - does that help?
RE: Array of Parts according to selection
Any ideas on that?