multiply selection in catscript or catvbs
multiply selection in catscript or catvbs
(OP)
how can i call up this dialog? i need to select several elements and then rename them

did a search on the forum but nothing.
thanks in advance.

did a search on the forum but nothing.
thanks in advance.





RE: multiply selection in catscript or catvbs
i have some vba but unfortunately it's password protected.
RE: multiply selection in catscript or catvbs
Dim oSelItem As Object
Set oSel = CATIA.ActiveDocument.Selection
For i = 1 To oSel.Count
oSelItem.Name = "prefix" + oSelItem.Name + " suffix"
End Sub
indocti discant et ament meminisse periti
RE: multiply selection in catscript or catvbs
RE: multiply selection in catscript or catvbs
I'll try my best to help you.
indocti discant et ament meminisse periti
RE: multiply selection in catscript or catvbs
oSelItem.Name = oSelItem.Name + i
RE: multiply selection in catscript or catvbs
For i = 1 To oSel.Count
Set oSelItem = oSel.Item(i).Value
oSelItem.Name = InputBox ("prefix")+ i
Next
RE: multiply selection in catscript or catvbs
sPrefix=inputbox("prefix")
For i=1 to oSel.Count
set oSelItem = oSel.Item(I).Value
oSelItem.Name = sPrefix + i
Next
RE: multiply selection in catscript or catvbs
RE: multiply selection in catscript or catvbs
if you give pt in the inputbox the previous code should work like a charm.
what do you mean it does not work with words?
indocti discant et ament meminisse periti
RE: multiply selection in catscript or catvbs
RE: multiply selection in catscript or catvbs
indocti discant et ament meminisse periti
RE: multiply selection in catscript or catvbs
RE: multiply selection in catscript or catvbs
Well, there are few modifications to be done but this is depending on what you want
CODE --> CATScript
Sub CATMain() Dim USel As Selection Dim InputObject(0) Dim oStatus InputObject(0) = "AnyObject"'selection filter forces user to select specific objects, AnyObject allows selection of any object Set USel = CATIA.ActiveDocument.Selection Msgbox "This macro will give you the name of a selected element, you have to select the FINISH button on the Tools Palette when you want to finish selecting" & vbCrLf & "This method work only with selection in Specification Tree" USel.Clear'You should clear the selection before making a selection oStatus = USel.SelectElement3(InputObject, "Select objects to list names", True,CATMultiSelTriggWhenUserValidatesSelection, False) If (oStatus = "Cancel") Then Exit Sub End If sPrefix=InputBox("String for prefix", "input", "prefix") For i=1 to USel.Count USel.Item(i).Value.Name = Cstr(sPrefix) & "." & i & "_" & USel.Item(i).Value.Name Next End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: multiply selection in catscript or catvbs
for string manipulation I use &
if you replace your oSelItem.Name = sPrefix + i by oSelItem.Name = sPrefix & i then all is fine
indocti discant et ament meminisse periti
RE: multiply selection in catscript or catvbs
RE: multiply selection in catscript or catvbs