Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all 383 articles
Browse latest View live

[V8-MDL] How to Call VC++ 6.0 Library functions in MDL

$
0
0
Hi, 
I have created a library in VC++ 6.0 version. Can I use that library functions 
in the plain MDL program ? I just added that library in my make file and 
tried to build. I'm getting ' abc.lib: Not a valid object file or library file. '
Any help.
Thanks & Regards,
Siva

Usage of Key in's in for loop

$
0
0

Hi Guys,

Requirement: Need to create boundaries based on the points.( Just like creating shapes using centroids in map)

Sample Dgn with more than 1500 points(with in a closed boundaries).

Using for loop i am sending each point to keyin.

mdlInput_sendKeyin("create region flood;xy=684350.6839,2820134.7587;Active create region flood;xy=684350.6839,2820134.7587", 0, 0, ustnTaskId);

Problems are:

Tool is taking more time of execution.

Missing creation in more locations.

Example:

for(loop)

{

mdlInput_sendKeyin(...........);

}

mdlDialog_openInfoBox("Boundaries Created Successfully");

When i click on the tool button(created programmatically) create boundaries i am getting the message "Boundaries Created Successfully" after that tool is running.

May i know where i am doing mistake ?

[V8i C++] Using IViewManager::DoElementAgendaDynamics()

$
0
0

If you want to create multiple elements and insert them into an elementAgenda, how should the ElementDescr's be handled in regards to releasing the memory? For example:

 

bool mytool::CreateGraphic( ElementAgendaR elemAgenda){MSElement el;MSElementDescr *edP=NULL;elemAgenda.Clear();mdlLine_create(& el, NULL, pts );mdlElmdscr_new ( &edP, NULL, &el);edP->h.dgnModelRef = ACTIVEMODEL;mdlElmdscr_validate( edP, ACTIVEMODEL );elemAgenda.InsertElemDescr( edP );mdlElmdscr_freeAll (&edP);  // needed ??mdlShape_create( &el, NULL, pts, 5, 0 );mdlElmdscr_new( &edP, NULL, &el );edP->h.dgnMOdelRef = ACTIVEMODEL;mdlElmdscr_validate ( edP, ACTIVEMODEL );elemAgenda.InsertElemDescr ( edP);mdlElmdscr_freeAll ( &edP); // again - needed?}

 

Thanks,

Bruce

 

Set Design File vba or key-in highlight color and Selection Color V8i is the program I use.

$
0
0

Tried this  a few moments ago and it lockup and I lost my message.

 

 

 

 

 

 The two items are what I want to change. I have a VBA macro that will preform this, but It seems so involved. I know someone with the knowledge can do it easy. I will post the macro.

 

 

'  1112133 - Modified, removed the Dim commands at top, removed CommandState.StartDefaultCommand
' 11/02/11 - Made New Replacement for the Older version. Deleted older
' macro and re-named new one to match older one. removed Macro 3 Handler 11
    'Dim startPoint As Point3d
    'Dim point As Point3d, point2 As Point3d
    'Dim lngTemp As Long

    Dim modalHandler As New Macro3ModalHandler11                                         SEE BELOW THE Macro3 Handler11
    AddModalDialogEventsHandler modalHandler

'   The following statement opens modal dialog "Design File Settings"

'   Start a command
    CadInputQueue.SendCommand "MDL SILENTLOAD DGNSET"

    CadInputQueue.SendCommand "MDL SILENTUNLOAD DGNSET"

    RemoveModalDialogEventsHandler modalHandler

 

 

Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult)

    If DialogBoxName = "Design File Settings" Then

    '   Set a variable associated with a dialog box
        SetCExpressionValue "dgnSet.hiliteColor", 8, "DGNSET"

        SetCExpressionValue "dgnSet.selSetColor", 5, "DGNSET"

    '   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Design File Settings

End Sub

This seems an awful lot just to change two colors, I searched and read for a while, but did not find the answer?

 

 

 

 

 

 

 

V8i SS3 VBA - Delete "Default" Model

$
0
0

I am trying to save out a single model in a dgn file using VBA.  I used to be able to do this with MDL by removing all of the models including default then saving the file out.  I can not seem to get VBA to replicate this behavior.  Is there a way to either save out a single model or delete all but one including the "default" model to another design file?

[V8 2004 MDL] Modal DialogBox sometimes doesn't close (when Geographics is loaded)

$
0
0

I had to use Geographics v. 08.05.02.11 with an old MDL software project (built with bmake).

Now some (not all) system and custom Dialog Box sometimes don't close when ESC, OK or Cancel button are pressed.

For example standard MDL function like mdlDialog_openInfoBox sometimes doesn't close.

It didn't happen before Geographics ....

It happens on Dialog Boxes using or not using a hook-function.

Using a "testing hook function" I can see that  events like DIALOG_MESSAGE_ACTIONBUTTON or DIALOG_MESSAGE_DESTROY are sent and received (and passed on) but the DialogBox doesn't close and I need to kill the process.

Any idea about this strange behaviour?

I know, it should be better to full rewrite that old project but .. I can't :-(

Change Model Properties in VBA

$
0
0

Before I jump into this, I thought I'd ask here first.

Does anyone have some VBA code that changes a model from design model to a sheet and then applies some of the additional properties that become available once a model is a sheet?

I tried recording a macro, but the result was not useful.

I am using InRoads to create plan and profile sheets. But it does not know sheets models from design models, so after its complete, I need to open evey sheet, change the model to a sheet, assign a scale, select a sheet size and tell it which reference file is my sheet.

And then, if I have to rerun the plan and profile generator, it all gets reset and I have to start all over again..

MDL [C] - Color Indexes in msdefs.h

$
0
0

I'm setting the background color of a ListBoxRsc and all is well of I use a basic color index (LGREY_INDEX, BLUE_INDEX, etc.), however if I use PALEYELLOW_INDEX, which is under Fixed colors beyond the menu colors -8.0 & 8.5, nothing happens. As always, many thanks in advance.

 

D


[V8i C++] Creating Closed Element

$
0
0

I'm attempting to create a "closed" shape for dynamic display inside a MstnPrimitiveTool. I've got a CreatePipe() function that takes an EditElemHandleR and the start/end points of my "pipe". The "pipe" consists of two parallel lines with an arc at end end. I use a local MSElementDescr to "accumulate" the four elements, the I use mdlElmdscr_close() and mdlElmdscr_addFill(). When I display the ElementDescr without closing/filling, it displays as expected. Once I "close", all I get is the first element (which is an arc) filled - no sign of the other three pieces. Are there any requirements for the ElementDescr that gets passed into mdlElmdscr_close() ? I'm using mdlElmdscr_appendElement() to put the elements into the final  ElementDescr. Elmdscr_close() is returning 0, so it *seems* to think the ElementDescr is OK. I'm displaying the "closed" ElementDescr inside the CreatePipe() function using mdlElmdscr_display( tempEdP, ACTIVEMODEL, DRAW_MODE_TempDraw);

 

Thanks,

Bruce

i am going to start mdl programing

$
0
0

Hi

My name is Ehsan and i am going to start programing with mdl language i work with microstation v 08.01.00.07 can you please help me how to start? I have already download microstation v8i sdk but as i read so many docs it dose not work with my microstation version.

[V8i C++] Creating a cell "on the fly" containing text and ANNOTATION SCALE flag

$
0
0

I'm creating a cell programatically, and that cell has text elements. If "Annotation Scale Lock" is OFF when the cell is created/placed. the text in the cell remains as placed (desired). When the lock in ON (enabled), once the cell is placed, it's text responds to changes in the annotation scale (not desired). Can the text somehow be forced to NOT be identified as "Is Annotation" ? I don't want to rely on the user to toggle the lock every time they use the tool, then toggle it the other way once the tool is complete. I tried setting TextParamWide.annotationScale=0.0 hoping maybe that would make it NOT annotation, but that didn't work. The cell is NOT an annotation cell when placed.

 

 

Thanks,

Bruce

How to get or set sheet definition Border Attachment [VBA]

$
0
0

I have scoured the help docs and cannot find any information on this. I am pretty sure I will need to use an MDL Wrapper function, but not only can't I figure our which MDL function, but when I find that, I will need help creating that wrapper.

TIA

MS v8 2004: capturing user actions and VBA subroutines (weird behaviour)

$
0
0

Dear MicroStation VBA Community,

we’ve observed some weird behaviour concerning MicroStation v8 2004 (german, 8.05.02.35, Win XP + Win7) VBA. Our VBA-Program contains forms, modules and class modules. The main GUI form is started using a module subroutine which instantiates a global runtime object (class module) which carries some other objects. The main GUI offers buttons for manipulating the ActiveModel like creating line strings, shapes and so on.

Additionally we are using an MDL module (3rd party product) which is capturing user interaction. The observed weird behavior affects that MDL module.

Using our VBA program with MicroStation v8i s3 (Win XP or Win 7 doesn’t matter) everything works. The user hits the button in the main GUI then does a click into a view and the MDL module captures the click. That’s the correct behavior.

Using our VBA program with MicroStation v8 2004 (Win XP or Win 7 doesn’t matter) the MDL module isn’t capturing the user click.

Using our VBA program with MicroStation v8 2004 (Win XP or Win 7 doesn’t matter) and calling the concerning sub directly using the key-in “vba run <name of the sub>” everything works fine. Using the main GUI button (s.o.) the MDL module isn’t capturing the user click.

What is the difference between the both sub calls? Are there different VBA modules or whatever loaded by MicroStation?

Any ideas?

Many Thanks in advance

Ingo

(v8i SS3 VBA) Trying to bring in contours from ArcMap to MS but elvations are coming in incorrectly

$
0
0

The issue is that I the contours I have came from a .shp file and the line elevations are not being stored as elevations.  Instead they are being stored as string values in a property called "ELEVATION".  I have tried many different ways to get these come in with elevation so I can create a surface, but so far with no luck.  I was thinking that I could write a macro to get each line in my selection and pull the value from the property and set it as the line elevation.

 

What I have so far:

Public Sub ImportElevations()
Dim oElEnum As ElementEnumerator
Dim oEl As LineElement
Dim oPropHand As PropertyHandler
Dim getElevationFromCustom As String

Set oElEnum = ActiveModelReference.GetSelectedElements
oElEnum.Reset
While oElEnum.MoveNext
    Set oEl = oElEnum.Current
    Set oPropHand = CreatePropertyHandler(oElEnum.Current)
   
    If (oPropHand.SelectByAccessString("ELEVATION")) Then
    getElevationFromCustom = oPropHand.GetDisplayString
   
    ' Write getElevationFromCustom to line elevation
   
    End If
Wend
    oEl.Redraw msdDrawingModeNormal
    oEl.Rewrite
End Sub

Has anyone dealt with this before?

Thanks,

Matt

Extracting name property from a Feature Solid

$
0
0

Hi, I have a vba which searches through a model and extracts the cell names and writes the names to a text file.

Feature Solids are (or were) cells and the output list would include the names of the Feature Solids.

Using SS3 version 08.11.09.459 I get a error 13

I have had a look at the SmartSolidElement and cannot find any Name properties.

How can I extract the Name of a Feature Cell?


[V8i C++] OnElementModify() and adding Linkage using mdlLinkage_appendUsingDescr()

$
0
0

I'm attempting to apply a Template and add a linkage to an element in OnElementModify(). When the tool completes, I get the element updated with the desired "template", but no linkage is attached. The mdlLinakge_appendUsingDescr() is returning SUCCESS. If I add in mdlElmdscr_add() after the ...appendUsingDescr(), I DO see the added linkage, but there is no indication of the Template values having been applied...

StatusInt       FeatureAddTool::OnElementModify (EditElemHandleR eeh)
{
 StatusInt  iStatus;
 // apply the template for symbology
 ElementTemplateP  srsWorkTemplate;
 iStatus=mdlElementTemplate_loadByPath ( &srsWorkTemplate, L"SRS_WorkTemplate" );
 iStatus = mdlElementTemplate_applyElementParams( srsWorkTemplate, eeh.GetElemRef(), ACTIVEMODEL, false );
 iStatus = mdlElementTemplate_free( &srsWorkTemplate );
 MSElementDescrP pElm=eeh.GetElemDescrP();
 UShort  hdr[4];
 
 hdr[0]=0x1003; hdr[1]=0x5352; // 'SR'
 hdr[2] = APPID_SRSLineWork; // APPID_SRSLineWork (0x1)
 hdr[3] = (srsDialogInfo.featureId << 8) + srsDialogInfo.featureStatus;
 int rc = mdlLinkage_appendUsingDescr(&pElm, (LinkageHeader*)hdr, hdr+2, NULL, NULL, TRUE); eeh.SetElemDescr (pElm, true, false); return SUCCESS;
}

I've also swapped the order of things (do the ...appendUsingDescr() first, but then I get the element WITH the linkage, but no Template parameters applied. How can this linkage be added? It seems that the mdlLinakge_appendUsingDescr() is invalidating the elementRef of the passed in EditElemHandleR. I've tried setting the EditElemHandle to NonPersistent and using ITxnManager::GetManager().CurrentTxn().ReplaceElement(...), that that call is returning "69652", so something's clearly not right...

 

Thanks,

Bruce

VB.net Microstation V8i programming for DAT/EM

$
0
0

I am programming MDL addin application using VB.net. It works perfectly. Now Iwant to synchronize my MDL application with DAT/EM (DAT/EM systems Capture for Microstation). Specifically, I want to open a dgn file in microstation and use vb.net codes (in the MDL application) to attomatically open the related DAT/EM  project and centered it like the dgn file in Microstation. Now I am using manually "mvuserpick" to "moves the stereoplotter to a location picked with the system mouse in the MicroStation view". I want to use something like mvuser <x>,<y>,<z> to move it automatically from my application. Could someone suggest me something? Thank you

Cursor position and mouse position

$
0
0

I am using Microstation V8i Select series#3 MDL addin application developed with vb.net (Micorsoft Visual Studio 2010). To run my application, I have to synchronize it with DAT/EM (DAT/EM systems Capture for Microstation) so my application use two mouses (one for DAT/EM and one for Microstation) and two screens (one for DAT/EM and one for Microstation V8i Select Series#3). When I do a click with DAT/EM mouse, I can get the coordinates of the related point in Microstation. Now I want to convert Micostation point3d coordinates to screen coordinates in order to take a screenshot around the point in Microstation. Could anyone suggest me something? Thank you

V8i Compilation Error

$
0
0

Hi,

I am getting the below error.Please help me to solve the issue

The error is

c:\Programfiles\Bentley\Micros2\Micors1\mdl\library\toolsubs.dlo : Unrecoverable errors detected. Output file not created.

BMAKE: call trace

Thanks and Regards,

saran

Size problem when creating cells with Bitmaps inside

$
0
0

Hi to all,

we create a cell from a bitmap file. The Bitmap size is 97 KB. When filling it into a cell library by using the clipboard it becomes 3307 KB large. This cell is used in a parametric object, created by MDL afterwards. The design file explodes if some bitmap cells were placed.

We have attached a picture, that shows our 6 steps to Import a jpg into a cell library.

Is there a better way to do this ?

 

with kind regards,

Willi

Willi Spiegel
Venturis Development

 

Viewing all 383 articles
Browse latest View live