I am using MicroStation V8i
8-digit version number is 08.11.09.829
I am not using Microstation in ProjectWise environment.
I am using the MicroStation V8i programming API with C#
I am using Visual Studio build tool.
Thanks and Regards,
Bangaruraju
I am developing an addin for microstation. For this we are using a custom menu. While the addin is loaded the custom menu will be loaded from .dgnlib
I want to disable some menu items in the custom menu till the user is login. Once the user is logged all the menu items need to be enables.
Please suggest, which name space need to be used from which dll.?
[quote user="Cathy Rust"]Can PRINTORGANIZER still be run as an INITAPP[/quote]
The best time to load a VBA macro is in the Application.OnProjectLoad event. Is that what you mean by INITAPP?
It's hard to debug this kind of event handler. Put some debug statements in there in an attempt to pin down where it fails...
Sub OnProjectLoad() TraceKeyin "mdl load bentley.printorganizer.dll"' TraceKeyin "PRINTORGANIZER DIALOG" TraceKeyin "PRINTORGANIZER NEW" TraceKeyin "PRINTORGANIZER PRINTERDRIVER pdf.pltcfg" TraceKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model1.dgn" TraceKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model2.dgn" TraceKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model3.dgn" TraceKeyin "PRINTORGANIZER SUBMITAS SINGLE" TraceKeyin "PRINTORGANIZER PRINT ALL" TraceKeyin "PRINTORGANIZER EXIT" End Sub Sub TraceKeyin (ByVal keyin As String) Debug.Print "About to send key-in " & keyin CadInputQueue.SendKeyin keyin End Sub
Hello Bentley Community-ites.
When trying to port our printing application from MicroStation V8i to CONNECT Update 2 I ran into a problem causing MicroStation to crash.
Taking the code from Example 1 of the Print Organizer Key-in section of the MicroStation Help and inserting into the MicroStation INITAPP:
Sub OnProjectLoad()
CadInputQueue.SendKeyin "mdl load bentley.printorganizer.dll"
' CadInputQueue.SendKeyin "PRINTORGANIZER DIALOG"
CadInputQueue.SendKeyin "PRINTORGANIZER NEW"
CadInputQueue.SendKeyin "PRINTORGANIZER PRINTERDRIVER pdf.pltcfg"
CadInputQueue.SendKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model1.dgn"
CadInputQueue.SendKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model2.dgn"
CadInputQueue.SendKeyin "PRINTORGANIZER ADD FILE c:\cadfiles\model3.dgn"
CadInputQueue.SendKeyin "PRINTORGANIZER SUBMITAS SINGLE"
CadInputQueue.SendKeyin "PRINTORGANIZER PRINT ALL"
CadInputQueue.SendKeyin "PRINTORGANIZER EXIT"
End Sub
causes the following exception to occur in MicroStation:
Managed Call Stack:
0: Void set_Item(Int32, System.Drawing.Image) from System.Windows.Forms.ImageList+ImageCollection in System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
1: Void SetMSIcons() from PrintOrganizer.AppForm in Bentley.PrintOrganizer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9bfed12b64a9b7df
The question I have is: Can PRINTORGANIZER still be run as an INITAPP in CONNECT Edition or I am doing something wrong/missing something?
Thanks
Cat
[quote user="Cathy Rust"]ustation.exe model1.dgn -waMyVba.mvba [/quote]
VBA is not designed or intended to operate as an INITAPP. That's reserved for MDL applications. I'm not surprised that it doesn't work with CONNECT, but I am surprised that it ever worked in MicroStation V8i.
The way to start a VBA macro early on is to write an event handler that responds to MicroStation events. VBA help describes those: search for Working with MicroStation events. We also provide some examples here. You can cause your macro to load either when the project loads or when a DGN file is opened.
If you look at "msmesh.h", you'll see this note:
All mdlMesh functions are deprecated. It is strongly recommended that code PolyfaceHeaders be used in their place.
Hi,
My system is windows 7, Connect update 4, Visual Studio 2013
I get error when including <msmdlmesh.fdf>
When I opened msmdlmesh.fdf I found this line:
#include <Mtg\MtgStructs.h>
However, file MtgStructs.h does not exist in Connect SDK.
----------------------------------------------------------------------------------------------------------------------------
Error 2 error C1083: Cannot open include file: 'Mtg\MtgStructs.h': No such file or director
4 IntelliSense: cannot open source file "_config-eccp.h"
----------------------------------------------------------------------------------------------------------------------------
Any ideas?
thanks
Nenad
Please follow the MicroStation Programming forum best practices.
Please identify the version of MicroStation, or other product such as PowerDraft, that you are using: MicroStation CONNECT or MicroStation V8i. What is the 8-digit version number (e.g. 10.xx.yy.zz) of MicroStation?
The APIs supplied with MicroStation CONNECT are different to those supplied with MicroStation V8i. Consequently, our answers are likely to be different.
When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil:
[quote user="Bill C"]How would you detach the current GCS with VBA?[/quote]
The GCS belongs to a VBA ModelReference. The following methods may be useful...
Curiously, I don't see a method to attach a GCS to a model reference.
There are VBA commands to report the currently attached GCS and one to attach a GCS. How would you detach the current GCS with VBA?
[quote user="Barry Lothian"]I do not know how I can detect if a coordinate is south of the chainage line[/quote]
One way to find if a point is 'left' or 'right' of a line is to use vector algebra. Construct one vector V1 from the chainage element's direction at the point of intersection. Construct a second vector V2 which is the perpendicular from the point onto the chainage line. Calculate the cross product of the two vectors V3 = V1 x V2.
With the result of that calculation, you can discover all kinds of stuff. However, if the thought of vector algebra and computational geometry seems too daunting, then it's time to hire a consultant.
As a followup to one of my previous threads here, the image below is is my target element (its 22miles long) with the placed cells also shown (very hard to see at this scale)
This is a close-up where the cells are visible and though difficult tell, they are placed perpendicular to the chainage element (turquoise):
I now have a requirement to add text (possibly a text node) near to each cell instance which where each string would be unique like below:
I have 2 issues (a far as I can tell),
Any suggestions how I can achieve the above?
[quote user="Bruce Reeves SRNS"]
If you look at "msmesh.h", you'll see this note:
All mdlMesh functions are deprecated. It is strongly recommended that code PolyfaceHeaders be used in their place.
[/quote]
While your observation is correct, that comment didn't make it into the documentation. Well spotted!
But, should we really be in the position where it's necessary to read the header files to find what is missing in the help file? Surely the automated document generation should take care of that? Furthermore, the recommendation is inaccurate: there is no PolyfaceHeaders (plural) class. There is a PolyfaceHeader (singular) class, which you'll find in header file include\Geom\Polyface.h.
Historically, MDL developers have been well-known for chewing iron filings for breakfast. Advances in programming language sophistication don't seem to be ameliorating our dietary habits.
I've got a tool that needs a single element picked (no fence, no selection set). Once the element is picked, I want that element to be un-hilited. I'm calling _UnHiliteAgendaEntries(false) in _OnDynamicFrame(), which probably doesn't need to be called on every frame. Where *should* _UnHiliteAgendaEntries() be called? I'd like the picked element to NOT be hilited while in dynamics.
Thanks,
Bruce
Hi Roland,
I tried to simulate the workflow you described and it works fine. My code is:
' Attach defined DGN file as reference with logical set to BORDER Public Sub AttachReferenceBorder() Dim refFile As String refFile = "ref_A.dgn" ActiveModelReference.Attachments.Add refFile, vbNullString, "BORDER", vbNullString, Point3dZero(), Point3dZero(), False, True End Sub' Iterate through all attachments Public Sub FindAndRenameLogicalBorder() Dim att As Attachment For Each att In ActiveModelReference.Attachments ProcessAttachment att Next End Sub' Test if attachment logical is equal to BORDER Private Sub ProcessAttachment(att As Attachment) If (att.LogicalName = "BORDER") Then ChangeAttachmentLogical att End If End Sub' Change attachment logical name to CHANGED BORDER Private Sub ChangeAttachmentLogical(att As Attachment) att.LogicalName = "CHANGED BORDER" att.Rewrite End Sub
If I use AttachReferenceBorder method and after it I start FindAndRenameLogicalBorder method, stored in different mvba file, the attachment with BORDER logical name is renamed to CHANGED BORDER locagical name.
Without further information like more code (please use Syntaxhighlighter tool to place any code), design file examples and your configuration details (do you use plain MicroStation or some other apps or ProjectWise?) I am not sure if it's possible to guess what is wrong.
With regards,
Jan
I have a vba that attaches a reference with a logical name as "BORDER". The reference dialog box shows the attached reference with logical name as "BORDER". I will then run a second vba that looks for reference logical name as "BORDER". The second vba does not find the reference with logical name "BORDER" unless I close the dgn file and reopen the dgn and run the second vba.
I have tried multiple ways to run the second vba with out opening and closing the dgn file.
Below is the first vba and it does find Border Logical which is named "BORDER". I tried renaming LogicalName a second time and rewriting the reference. Strange that it does find the LogicalName_Border correctly.
Do While (iRef <= LocalVar_Attachments1.Count)
If (LocalVar_Attachments1(iRef).LogicalName = Border_Logical) Then
' LocalVar_Attachments1(iRef).Rewrite
LocalVar_Attachments1(iRef).LogicalName = "BORDER"
LocalVar_Attachments1(iRef).Rewrite
Exit Do
End IF
iRef = iRef + 1
Loop
When running the second vba and do a watch on the reference logical name it does not find "BORDER" unless file is closed and reopened before running the second vba. The reference dialog box shows "BORDER" logical name before closing and reopening the dgn file. Is this possibly a bug in the program.
Here's what I do to create an area formatter corresponding to the Mstn Property Formatter schema...
WCharCP AreaClassName { L"AreaClass" }; ECN::ECClassCP formatClass { formatSchema->GetClassCP (AreaClassName) }; StandaloneECEnablerP enabler { formatClass->GetDefaultStandaloneEnabler () }; StandaloneECInstancePtr localInstance { enabler->CreateInstance () }; WCharCP PropUnitDecorator { L"UnitDecorator" }; ECValue valDecorator { decorator }; localInstance->SetValue (PropUnitDecorator, valDecorator);
This works fine — I get an area formatted something like 10 Sq. m or 10 m2. But how do I prevent the formatter from appending that decorator? I want to append my own decorator, using engineering format, so it looks like 10m².