Need help with powerselector for a macro.

Need help with powerselector for a macro.

Post by ldrbrya » Sun, 21 Nov 2004 01:46:32

Here's what I'd like to do and can't seem to find the proper commands
to get it done.

Here at work we do a lot of files, some of the information we use is
not supposed to be printed and shipped out so it all gets put on level
40. Here's what I would like to do:

First select everything on level 40. I know the program does this
pretty easy as I can go through powerselector, then level, then type
in 40 and it does it.

Then delete the selected items, that's easy enough.

Then I would like to have the program search for the date and replace
it. That's also easy since there is a find/relace text in the menu,
but having the program do it would make it a lot faster.

I think that's all I'd like to have it do for now. But I'd also like
to know if either the program or somewhere on the internet has a list
of commands that can be keyed in. I have yet to be able to figure out
somethings by keyin, like the powerselector. I'm probably missing
something easy, but it would also be nice if the program had a way of
telling me exactly what commands I had just entered.

I have tried to do the "make macro" option as well but that only turns
on the powerselector and does not select everything on level 40.
Hopefully someone can help me out here.


Need help with powerselector for a macro.

Post by Jeffrey Ma » Sun, 21 Nov 2004 05:58:03

ello Bryan,

A good way to find keyins (other than the helpfile :) is to open the keyin
browser & drag its lower-right corner down to expose the browser fields. Tag
the tables button & select the MDL you are wondering about (in your case,
PSELECT) and its 'root' keyin commands are shown in the lower-left pane. Tag
one of these, and selections for the next word (only those applicable to the
selected first word) appear. This is a good way to find those 'hidden'
command strings (that might not be in the helpfile :) for use in your
macro's MbeSendKeyin "<command>" statements. Not all MDLs are loaded at
start, some must be loaded manually for their keyins to show in the
listings. Another source is the cmdlist.h file, which you want to make a
copy of this, rename it cmdlist.txt, and peruse it in a texteditor. Under no
circumstances make any alterations to the existing cmdlist.h file! AFAIK
there is not now nor never will be a 'comprehensive-up-to-the-minute'
listing, but when all else fails, Ask Inga! and select
Keyins from the Categories list.

That said, IMO you should be using selectbyattributes rather than
powerselector for your 'preprint' macro, remembering that selectby might
already be loaded, and might already have choices made in it, it might be
best to begin with:

Sub Main()
' since selectby might already be running with various changes in its state,
' first unload it, then reload it to initialize its ground-state
' reload selectby with clean settings
' clear the levels
' select the desired level
MbeSendCommand "SELECTBY LEVEL 40"
' start the search
' then delete the selected elems
' unload selectby
' start the default command
End Sub

Changing the date by macro would be a little more difficult, it would help
ENORMOUSLY if the date textelem has discrete attributes (a combination of
Lv, Co, Lw & Ls) that are NEVER shared with any other textelems. Then the
selectby can be set to search for the text-element type and those specific
attributes, then match the elem attributes, match the text attributes, store
the elem origin, build a string variable from the system clock, and place
the string as a textelem at the stored MbePoint.

1) Keep the actual print-date on the title-block ref file(s) where only
these must be manually altered before plotting, or
2) Instead of writing the actual date in the file, place the textstring
$DATE$ in the file & use a pen table to replace it with the actual date.
Search the help for "Text Substitutions". Replace $DATE$ with _DATE_ in the
TextSubs dlog. The Windows OS will replace _DATE_ with your Windows locale
short date format (mm/dd/yyyy in USA) but this can be changed with a uStn
config var. I'll send you the details if you want to do this.
3) You could use the same pen table to 'turn off' Level 40.
The pentable filename should be specified in your plt file or plot.ini file
or as a (standards.cfg or <project>.pcf) config var - it's easier to set it
up to load automatically than it is to remember to load it manually.

Jeffrey Malter

"Bryan" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


Need help with powerselector for a macro.

Post by ldrbrya » Wed, 24 Nov 2004 00:56:59

Jeffrey Malter" < XXXX@XXXXX.COM > wrote in message

Actually I do know about this, that's how I was trying to figure out
how to do the Powerselector. I could get it to do everything else but
select the level.

I will have to look into this, maybe there are things in there that
will help me in other areas.

Again, another place I can look. I don't remember seeing this site
when I was looking on Google for Microstation help.

This worked perfect, just what I was looking for, thanks a lot. I
didn't know about the selectbyattributes at all. We do very little
around here that goes any deeper then line and text work. AFAIK I'm
the only one that's looked into this type of thing at all.

I guess I said it wrong, it's not really a date per say, it's a date
the files will be printed on in the future. I make aeronautical
charts so the date is the dat the chart is to be used. I actually
wanted to do a global change all of the word FIG to 00000. Right now
I just use the find/replace text under edit, I just thought there
might be a better way, I just didn't say it correctly at first.

Well we have enough problems with people around here just remembering
to print properly, let alone having them try to remember something
else, hence the reason to just get rid of one level.

Thanks again for the help Jeffery.


Need help with powerselector for a macro.

Post by Thomas Vog » Wed, 24 Nov 2004 07:37:55

don't see the original question- but also have a look at Quickset/Named
groups if you are on late versions.

regards / Thomas Voghera

"Bryan" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
Under no


Need help with powerselector for a macro.

Post by Inga Moroz » Thu, 25 Nov 2004 02:29:22

In addition to what's already been posted,

Select All Elements on Active Level

To select all elements on level 40, prepend the keyins noted in the tip with
LV=40 may want to post this in the appropriate Bentley discussion
group at:

You'll find a terrific community of MicroStation users over there who are
always willing to help.

Best Regards,
Inga Morozoff [Bentley]