Hello all,
I am creating a module and I want to select only text in one level. Could you please help me with that!?
The thing I wrote until now:
CadInputQueue.SendCommand "CHOOSE ELEMENT "
CadInputQueue.SendCommand "POWERSELECTOR AREA BLOCK "
CadInputQueue.SendCommand "POWERSELECTOR MODE ADD "
CadInputQueue.SendKeyin "level element select ""level name"""
..Now I want to select only! the text in “level name” and put it “active” to use it for the following:
CadInputQueue.SendCommand "Change Attributes "
CadInputQueue.SendKeyin "CHANGE ATTRIBUTES USEACTIVE ON"
Thank you in advance.
Best regards
Katrin
I agree with Phil, a more elegant (and non-intrusive method would be to use Element Enumerator).
Here's some example code (been a while since I've done VBA but this should work).
Dim textLevel As Level
Set textLevel = ActiveDesignFile.Levels("text")
Dim scanCrit As ElementScanCriteria
scanCrit.ExcludeAllTypes
scanCrit.IncludeType (msdElementTypeText)
scanCrit.IncludeType (msdElementTypeTextNode)
scanCrit.IncludeLevel (textLevel)
Dim eleEnum As ElementEnumerator
'this returns all the text and text node element on "text" level
Set eleEnum = ActiveModelReference.Scan(scanCrit)
Do While eleEnum.MoveNext
'you can change attributes or text inside the element here
Loop
Look at the "Scan Method" in the VBA documentation for some great examples
A low-tech solution could be to replace
CadInputQueue.SendCommand "CHOOSE ELEMENT "CadInputQueue.SendCommand "POWERSELECTOR AREA BLOCK "CadInputQueue.SendCommand "POWERSELECTOR MODE ADD "CadInputQueue.SendKeyin "level element select ""level name"""..Now I want to select only! the text in “level name” and put it “active” to use it for the following:
with
CadInputQueue.SendKeyin "mdl silentload selectby;selectby type none;selectby type text;selectby level Text;selectby execute"
(watch word-wrapping... that is all one statement) where Text in selectby level is the name of the level that you want to "isolate". A more elegant approach would be to implement a criteria scan.