can you specify what MicroStation version and what language do you use?
With regards,
Jan
[quote user="willmartinpe"]To hover over an element and display some customized 'tooltip'[/quote]
Do you want custom tooltips when your app. is active, or more generally.
For example, if your app. is to do with water pipes, do you want a tooltip that describes a line element as "Water pipe 200mm" under the right circumstances?
Hi,
in my opinion the only way how to customize element information hint / tooltip is to use MDL API which requires to use Visual Studio 2005 to compile native C/C++ code.
I recommend to search BE Communities for LOCATE_PROVIDE_PATH_DESCRIPTION, because it's callback value used for LocateFunc_providePathDescription. Also see MicroStation V8 MDL Function reference for furher details.
With regards,
Jan
That's what I'm trying to do. My "environment variable" is defined in the .UCF file, and when I pass the string to mdlRefFile_reattach() as "REFHOME:fileName", I get a SUCCESS return code, but I don't get the display of the filename as "REFHOME:fileName", I just get the same thing I started with: "fileName". I can manually insert it using the reference file's "Settings" - I just can't seem to do it via native code...
Bruce
If you know how to "extract" the information you want from the element you're hovering over, it can be done using the method Jan/Jon mentioned.
If you want it "active" all the time, you can set the function up in some code you load a startup (DGNAPP or INITAPP). You use mdlLocate_setFunction() to start it, and supply a function that gets called as the locate logic finds elements. Your task is to determine the information you want to display and essentially "append" it to the MicroStation information that is displayed. Here is an old example that displays an element's line style name.
Public void myLocateInfo ( DisplayPathP path, MSWChar* description, MSWChar* refStr ) { ElementRef eRef; MSElement el; char styleName[64]; MSWChar wStyleName[64]; int eSize; eRef = mdlDisplayPath_getCursorElem (path); eSize = elementRef_getElement (eRef,&el,sizeof el); sprintf_s(styleName,sizeof(styleName),"\n"); mdlElement_getEffectiveLineStyle(styleName+1, NULL, &el, ACTIVEMODEL, NULL, 1); mdlCnv_convertMultibyteToUnicode(styleName, -1, wStyleName, 64); mdlWideChar_strcat ((MSWideChar*)description, (MSWideChar*)wStyleName); }
It's C++, but you should get the idea.....
Bruce
Hi,
[quote user="willmartinpe"]I am using C#[/quote]
I guess it was clear: You have to use MDL / C API, there is no equivalent in C# (which in fact is not pure managed NET API, but only Interop in V8i).
[quote user="willmartinpe"]I looked at the LOCATE_PROVIDE_PATH_DESCRIPTION in the API reference and do not understand in the least how to set that up.[/quote]
This is a standard way how hook functions / events were (in fact still are) implemented in C language: You create callback function with defined pattern (parameters and return value) and use the name of this function (variable) to set up it as mdlLocate_setFunction together with LOCATE_PROVIDE_PATH_DESCRIPTION parameter. You can find examples in MDL examples, search for mdlLocate_setFunction.
[quote user="willmartinpe"]Also, what is the command state in which this takes place, i.e., a locate command or primitive command?[/quote]
See Bruce's code snippet.
With regards,
Jan
[quote user="Bruce Reeves SRNS"]Exactly "what" it contains is never defined/documented such that you can understand it. [/quote]
Good and important note! :-)
Just for reference, it's defined in mstypes.h as
typedef struct DisplayPath const* DisplayPathP;
where DisplayPath struct is not defined anywhere (at least I was not able to find it), so it's "opaque pointer" that is used as value passed to and from mdlDisplayPath_ and other functions.
With regards,
Jan
Is there anyway to custom the 'tooltips' such as are displayed with element selection.
To hover over an element and display some customized 'tooltip'.
I wrote a macro based in excel that creates spiral stairways for storage tanks & ran into the exact problem you are describing. The resulting helix was beyond our shops fabricating tolerances. They would never have fit together in the field. The only solution is to drive the microstation helix tool. It works fine, but is slower than the vba helix code. Be sure to send explicit data to each of the tools settings, else it could use an existing data already present in the dialog box. Also, I could not get it to place the helix at the start azimuth I wanted, so I simply rotated it with some extra code.
I also found it was easier to copy the original helix the correct depth of the stringer & then skin a surface between them to create the surface than to extrude a shape, as I had issues with the profile twisting as it progressed along the helix. Dont forget to offset some helix copies for your handrails as well. You can get it to work, it will just take more coding than it should have.
Do as Jon suggests and record a macro while changing all the settings. It does record all the necessary key strokes you will need.
Hi Karthik,
in my opinion some analytic geometry facts should be clarified: You asked "Project points to the surface", but as you wrote, you have non-planar shape in your design file. They are two completely different things, something like to say line and circle are the same. And you should be aware that regardless MicroStation allows to create non planar shapes, it's usually treated as incorrect geometry that cannot be used for geometry computation.
With quite big simplification:
The summary is that even if you will find some method (I guess not in VBA but maybe in MDL) how to project point to non planar shape, it's not defined anywhere what does it mean and how it works.
I don't know concrete solution (did you try to search this forum?), but I guess it's about to convert the shape into some more correct geometry (SmartSurface, mesh, maybe also B-spline surface, but I am not quite if it's good idea) and in the second step to find a method calculating the intersection between ray and the element. I think for example there is such function available for mesh in MDL API.
Alternative solution can be - but only if the unplanarity is very little and is caused by creation error, not because the shape is e.g. terrain boundary - to calculate an average plane from the shape vertices, so the solution will be converted into intersection between ray and plane, which is easy and can be done in VBA.
With regards,
Jan