select an item and then launch a macro
select an item and then launch a macro
(OP)
Hello everyone.
How can I get a macro to work with an item previously
clicked (in particular, I'm talking about a dimension in a
design)?
My problem is to find a command that can recognize an item if is highlighted or not and then use it in macro.
Thanks
How can I get a macro to work with an item previously
clicked (in particular, I'm talking about a dimension in a
design)?
My problem is to find a command that can recognize an item if is highlighted or not and then use it in macro.
Thanks





RE: select an item and then launch a macro
Read the API documentation for these calls. and be careful of earlybinding / strong typing the selection object if you are going to use any of the calls that require an array of variant strings.
Very roughly something like the following (not tested)
Dim oDoc
Dim oSel
Dim vaFilter(0)
Dim sRet
Dim oObject
Set oDoc = CATIA.activeDocument
Set oSel = oDoc.Selection
vaFilter(0) = "DrawingDimension" 'not sure if this is the correct type name for a dimension object
sRet = oSel.SelectElement2(vaFilter,"Select Dimension", true) 'the true here allows preselection
if sRet = "Normal" then
set oObject = oSel.item(1).value
else
msgbox "Selection canceled"
end if
RE: select an item and then launch a macro
Now i've another problem: i use this routine to create
labels(drawingtexts) associated to dimensions, and so i need create a similar routine for eliminate these texts.
The only way that i've found at the moment is to use
"drawingtexts.remove(0)" but is very difficult to use it coupled with the routine above.
Any idea?
Thanks
RE: select an item and then launch a macro
RE: select an item and then launch a macro
Thanks again Peter