To restate - is there any simple way to plot a transient element?
Regards,
Pat Mackinlay
Kaiser Engineers.
Transients are one of those poorly implemented features in uStn.
(if you want to know about pitfalls, let me know)
An untested speculation follows:
I think you can write an MDL app which hooks a view update event,
mdlView_setFunction ( UPDATE_EACH_ELEMENT, displayCheck );
There is a similiar hook for plot event.
The hook function receives (as arguments) file position of
anything being displayed, just prior to display.
Whenever the file position is ZERO, it may be the transient
(or more precisely speaking, the descriptor associated with
transient).
I say 'may be' because anything calling mdlElmdscr_display
may trigg it too.
HTH
--
Remaining With Our Very Best Regards,
/Chris Zakrewsky
+------------------------------------------------------+
| ch...@cadperf.se http://www.ustation.se |
+------------------------------------------------------+
| Team uStation AB (CAD Perfect) |
| Älta Strandväg 37B, S-138 33 ÄLTA, SWEDEN |
| tel +46 8 773 1003 fax +46 8 773 3004 |
+------------------------------------------------------+
| Bentley MVAR, Independent Software Developer |
+------------------------------------------------------+
Patrick Mackinlay wrote in message <37e1a177$0$20...@motown.iinet.net.au>...
Nice idea - I was working along similar lines myself. Unfortunately, it
appears MicroStation never sends the transient element to the
updateEachElement() user function when doing a plot, only when updating a
view. I suppose a possibility is to capture all the transient elements from
a view update, and stuff them into the plot queue using
mdlElmdscr_displayInView() when the plot is activated, but it seems
unneccesarily inefficient.
Part of the problem I had initially was actually trying to "plot" a single
element - I couldn't seem to find any way to do this, and it was only when I
stumbled across the "textwash" example in SE that I saw the reference to
mdlElmdscr_displayInView(). This function is not documented anywhere else,
AFAIK, but I assume that in the case of plotting, the windowP points to a
"virtual" view?
Can anyone from Bentley shed any light on this idea? Is there some way to
get the transient elements into the plotting queue?
Regards,
Pat Mackinlay
Kaiser Engineers
Yes, I agree, if someone at Bentely knows how to pass an element to the
plotting process, it would be appreciated.
My work around for plotting transient elements is to write them to a
temp DGN, attach the DGN in reference, and then detach & delete the DGN
when the plot is completed. Not so nice...
Dominique Prémillieu
Sent via Deja.com http://www.deja.com/
Before you buy.
I'm by no means an expert on transient elements, but I will tell you what I
learned by looking at some source code and trying a few tests.
Here's how I was able to plot transient elements:
1) I set up a post-plot hook by calling
mdlView_setFunction (PLOTUPDATE_POST, plotHook)
2) plotHook() calls mdlTransient_returnElemDescr() to obtain a "real"
element descriptor containing the elements described by the (void *)
transient element descriptor.
3) plotHook() then passes the element descriptor to mdlElmdscr_operation(),
passing plotElement() as the callback, the window pointer as the
callback parameter, and ELMD_ALL_ONCE as the processing flag.
4) plotElement() calls mdlElmdscr_displayInView() to plot the element. If
plotHook() called mdlElmdscr_displayInView() directly, only the first
transient element plotted.
MicroStation calls the post-plot function after it finishes plotting the
elements it knows about, but before it closes the plot file. As a result, the
transient elements plot on top of all other elements, and cannot be modified
by a pen table.
Executing Steps 2-4 above in a pre-plot hook does not work, because the
plot "view" isn't properly set up when the pre-plot hook is called. By the
way, your thoughts about there being a virtual view for plotting are pretty
accurate.
If you want to plot the transient elements earlier in the plotting process,
you can do it from an UPDATE_EACH_ELEMENT hook, but you'll need to take care
not to plot the transient elements each time the hook is called, and you'll
have to protect against infinite recursion. (displayInView() results in a
call to the each-element hook, which calls displayInView()...)
Please note that I tried only simple transient elements (no complex shapes
or cells), so consider the outline above as a starting point, not as a
definitive solution.
Ron Stewart
Bentley
Patrick Mackinlay wrote:
>
> Nice idea - I was working along similar lines myself. Unfortunately, it
> appears MicroStation never sends the transient element to the
> updateEachElement() user function when doing a plot, only when updating a
> view. I suppose a possibility is to capture all the transient elements from
> a view update, and stuff them into the plot queue using
> mdlElmdscr_displayInView() when the plot is activated, but it seems
> unneccesarily inefficient.
>
> Part of the problem I had initially was actually trying to "plot" a single
> element - I couldn't seem to find any way to do this, and it was only when I
> stumbled across the "textwash" example in SE that I saw the reference to
> mdlElmdscr_displayInView(). This function is not documented anywhere else,
> AFAIK, but I assume that in the case of plotting, the windowP points to a
> "virtual" view?
>
Thanks a lot for your insights.
It seems that finally someone had guts to dig-in this area.
A good tidbit it is :-)
My humble questions follow:
Is there ANY hope for transients to became:
1. snappable
2. displayable when view is being scrolled
3. not vanishable when drawing is EXCHANGED to another one
--
Remaining With Our Very Best Regards,
/Chris Zakrewsky
+------------------------------------------------------+
| ch...@cadperf.se http://www.ustation.se |
+------------------------------------------------------+
| Team uStation AB (CAD Perfect) |
| Älta Strandväg 37B, S-138 33 ÄLTA, SWEDEN |
| tel +46 8 773 1003 fax +46 8 773 3004 |
+------------------------------------------------------+
| Bentley MVAR, Independent Software Developer |
+------------------------------------------------------+
Ron Stewart [Bentley] wrote in message <37EBC1DD...@bentley.com>...
You wrote:
> Is there ANY hope for transients to became:
>
> 1. snappable
>
> 2. displayable when view is being scrolled
>
> 3. not vanishable when drawing is EXCHANGED to another one
I don't know. I'm the wrong guy to answer this question. My responsibilities
are in the plotting area, and I have plenty to keep me busy there. I'm sorry
I can't be more helpful here.
Regards,
Ron
Sorry, I took this offline with Ron, and missed your post, Chris.
Unfortunately, Ron's solution won't help me because my third party
application wasn't written/developed by me, but by another company (ie:
third party to me). The reason it doesn't help is that Ron's "step 2" simply
says:
> 2) plotHook() calls mdlTransient_returnElemDescr() to obtain a "real"
> element descriptor containing the elements described by the (void *)
> transient element descriptor.
and in my case I don't have a pointer to the list of transient elements
being maintained by MicroStation. What's a real shame is the fact that
MicroStation is responsible for managing the transients for *all*
applications - obviously, since it must display them etc, but there's no way
to ask it for a pointer to the chain... If I could do that, my problem could
be solved fairly simply...
Any other clues from anyone?
--
Regards,
Patrick Mackinlay
Kaiser Engineers