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

[CONNECT VBA] Fence and Selection Set Events

$
0
0

Can I suggest that VBA includes event handlers for Fence and Selection Set?

Why?  Here's an example...

Dialog Having Fence and Select Set options

The above dialog (VBA UserForm) has buttons, in the Element Source group, to select where to obtain an element enumeration.  The dialog can detect whether a fence or selection set is active when it loads, and enable the appropriate button.  If user subsequently changes either of those (e.g. turns off the fence or cancels the selection) the dialog can't see that change of state.  It's inconvenient for the MicroStation user.

Other languages (C++ and .NET) support events for Fence and Selection Set.  Can VBA have wrappers around those event handlers?


Design File change Mil to inches via VBA

$
0
0

I have searched , worked from 3am to 7:11am trying to figure out how to change the Master Unit to inches via VBA command and the Sub Unit to inches

I tried to figure out how to use the ActiveModelReference.UORsPerMasterUnit, I tried goggling it, I finally got it via a key-in command. Seems sloppy

most of the information I have from Jan S and Jon S, but never need to change from inches to mil and back. I feel sure it is out there but I ran out of ideas for searching

the answer. I have some notes in the VBA Macro that I am going to save in my Micro Station Word document. We know it can be done manually, but I am now in a series of drawings that I am having to change the Design File and wanted to automate. I have 1 already for the standard setup, but the unit was never the issue. I also tried a message to Yongan. Fu

who had sent me a link that was helpful. I hope someone will have mercy on me and give me the VBA way.

Sub SetWorkingUnitsFractional()           '

'   081620 - This sets the Units and Accuracy in Decimal, if you go to 12 it sets 64ths fractional
'    Never could figure 0ut how to do all in VBA had to use Key-in spen hours on this.
    '   Start a command
    
     Dim MyUnit As MeasurementUnit
     MyUnit.System = msdMeasurementSystemEnglish         'this was a tip I read ?
     ActiveSettings.CoordinateFormat = msdMasterUnits       'Causes Only MU to be on
     'ActiveSettings.CoordinateFormat = msdSubUnits          'Causes MU:SU to come on
     'ActiveSettings.CoordinateFormat = msdMasterUnits      'Causes MU:SU:PU to come on
'     ActiveSettings
    CadInputQueue.SendCommand "set units inches"
    ActiveSettings.CoordinateAccuracy = msdAccuracy64th
    'ActiveModelReference.UORsPerMasterUnit = inches             ' Failed attempt
  ShowStatus "Accuracy 1/64"
    
    'CommandState.StartDefaultCommand
    
End Sub

MicroStation CONNECT Edition SDK 10.14.00.109 Examples Build Errors

$
0
0

Using Microstation Connect and VS2017. I have successfully downloaded and installed the SDK and I am able to run the "buildallexamples" bat file with no issues now. (Had fun tracking down the .NET framework 4.6.2 errors that many have got it seems). But that is working now. My issue is when I figure up devenv from the developer shell and open a solution. The example solution will open up, and references all appear to be intact however I get a warning that "The 'Code Analysis Package' package did not load correctly. 

Upon further investigation the ActivityLog file it refers to me has 2 lines hilighted at the bottom. Can Anybody shed any light?

[CONNECT C++ U14] Issue with mdlDialog_hookItemSendUserMsg

$
0
0

Hi everyone 

In our mdlMain we have somewhere :


 SystemCallback::SetWindowsKeystrokeMessageFunction(CatchToucheClavier);

And also this following code : 

bool CatchToucheClavier(void* windowID, UInt32 messageNumber, uintptr_t wParam, intptr_t lParam, long x, long y)
{
GestionRaccourciToolsBoxGeneral((int)wParam,DIAGID_AlmBoxToolsGeneral);
}
void GestionRaccourciToolsBoxGeneral(int key, RscId dialogID)
{
 MSDialogP dialP = almDialog_find(dialogID, NULL);
  DialogItem *itemP = NULL;
  StRsc_AlmIconCmd *zmRscIconCmdP = NULL;
  AlmToolsDlgBoxRsc *zmrscP = NULL;
  UInt64 cmd;
  ULong valeur;
    if (dialogID != DIAGID_DscObjet)
    {
      int nbItem = mdlDialog_itemsGetNumberOf(dialP);

      for (int i = 0; i < nbItem; ++i)
      {
        itemP = mdlDialog_itemGetByIndex(dialP, i);
        if (itemP != NULL && itemP->type == RTYPE_IconCmd)
        {
          if ((zmRscIconCmdP = (StRsc_AlmIconCmd*)Alm::Basic::Resource_load(
            0, RSCST_AlmIconCmd, itemP->id)) != NULL)
          {
            int j = 0;
            while (zmRscIconCmdP->clavier[j] != 0)
            {
              if ((key == zmRscIconCmdP->clavier[j]))
              {
                if (itemP!=NULL && itemP->rawItemP != NULL)
                {
                  mdlDialog_hookItemSendUserMsg(itemP->rawItemP, DITEM_MESSAGE_QUEUECOMMAND, NULL);// <=Crash after 3/4 down of a key
                  Alm::Tool::Resource_free((void**)&zmRscIconCmdP);
                  break;
                }
              }
              j++;
            }
            Alm::Tool::Resource_free((void**)&zmRscIconCmdP);
          }
        }
      }
    }
}

The goal here, is to handle keyboard key press event for our dialog box DIAGID_AlmBooxToolsGeneral when it doesn't have focus.

In microstation v8i we do not need to use "SystemCallback::SetWindowsKeystrokeMessageFunction" we juste have a hook where we handle  DialogMessage DIALOG_MESSAGE_KEYSTROKE. 

But i dont know why, since connect , this way does not work anymore.

My issue is after 3 or 4 press on a key this function mdlDialog_hookItemSendUserMsg crash and i don't know why. i tried every possible value for DITEM_MESSAGE_something but it still crashing.

Do you have any idea why?

Is there an other way to handle key press for a windows who does not have focus?

Thanks for your help

Rgdts 

Arnaud

Created time stamp is wrong when using mvbasign.exe

$
0
0

Hi there, I am using mvbasign.exe to create a digital signature for mvba files. This works so far, but when checking the signature with checksignature.exe the signed date is not today's date. Instead it is signed with 1970/01/01 02:00:00. Any idea how to have it signed with the current time and date? Thank you and best regards

How to attach Raster PDF on page 3 programmatically ?

InputCallback::SetMonitorFunction / CMD_EXIT / INPUT_REJECT does not work when closing with system menu close icon

$
0
0

Hello,

 As a user we want to show a OK / Cancel custom dialog box when closing Microstation. When click cancel, Microstation must remain opened.

We implemented this as fallows:

InputCallback::SetMonitorFunction(monitorFunction, InputMonitorFilter::MONITOR_ALL);

InputFilterReturnValue monitorFunction(Inputq_element* queueElementP) {
		if (queueElementP->u.cmd.command == CMD_EXIT
			|| queueElementP->u.cmd.command == CMD_EXIT_NOUC
			|| queueElementP->u.cmd.command == CMD_CLOSE_DESIGN
			) {
			int res = MessageBox(NULL, L"Realy Close ?", L"Custom Addin", MB_OKCANCEL | MB_ICONQUESTION);
			if (res == CANCEL_BUTTON) {
				return INPUT_REJECT;
			}
		}
		return INPUT_ACCEPT;
	}

This works fine when the user exit Microstation with key in command (EXIT or QUIT) or main menu File -> Exit or File ->Close Design

BUT, this does not work when closing Microstation with sytem menu close icon (X icon). When user click  the close icon, Microstation main window closes prematurely , the custom dialog box is showing and when the user click cancel, microstation.exe process is still running, but there is no Microstation window opened anymore. One must kill the process from task manager. When clicking OK, microstation.exe process is terminanted as expected.

Why this behavior is different than key in commands, are we missing Something in the code or is this a BUG or is there another way to implement this ?

Microstation Version : CONNECT Update 13

Microstation SDK : SDK Update 13

[MVBA] How to select a file

$
0
0

Hello All,

I'd like to select a file by dialog, like excel.FileDialog. I found shell.browseforfolder, but it is for folder, not file. Does anyone know how to select a file in MVBA? Thanks a lot.


How to get the current view zoom extends Coordinates?

$
0
0

Dear All,

                I am working with Microstation v8 2004 Edition with the VBA. I need to place the rectangle of the current view zoom extends. for clear understanding please refer the below image.

In this image yellow color shape is my expected output.

Please any one give me a reference for how to do this requirement.

Thanks & Regards,

Karthik M

UserForm_Initialize Sub Causes MicroStation to Crash

$
0
0

V8i SS3 VBA

I'm developing a set of tools for a client in VBA. We're both using V8i SS3, but I'm sure there are differences between their machines and mine. I've found that when I comment out the "Private Sub UserForm_Initialize()" within a form on their machines, they are able to bring up the form without issue. However, when this is uncommented, even when there's no code within the sub, showing the form causes their MicroStation application to crash. I've even placed a stop at the header line of "Private Sub UserForm_Initialize()" when debugging and it crashes before it even gets there. It seems that merely the presence of that sub causes a crash. The best I could find so far is This MicroStation Wiki Post, but the client is not using Microsoft Office 365.

My delivering a working set of tools for them depends on them being able to bring up all the forms without crashing. I would greatly appreciate any assistance.

Thanks!

-Chris Johnson

v8i Built-in uStn Library of Shapes or text frames.

$
0
0

All

I am starting a new VBA project for our group to place call-outs & notes that are NOT dimension styles.  I am defining the call-outs as a text field with a frame around it using predefined symbols, e.g. circle/ellipse, box, diamond(rotated box), hex and triangle.

I the past v8 versions Bill Stienbock wrote an mdl application called "drafting tools" in which our organization relies on very very heavily.  The problem with using dimension styles is the use of annotation scale for the scaling of the objects.  This also affects the text size in our designs since all of our projects dating back to 1992 are setup in the same way.  Models are drawn 1:1 with borders / title-blocks are scaled up to a standard size 1/4in to 1ft etc....

I am looking for a method or library within uStn that would have these shapes that can be called via a VBA project to place call-outs & notes in a design file.  Maybe the detailing symbols application could be used as a starting point with another dgnlib created with the types of symbols used and second toolbar??

Any input or examples of placing calls that are not dimension styles would be much appreciated.  More info on Detailing Symbols MDL is also appreciated.

USTN: 08.11.09.919 (SS10)

OS: Win10 64bit

Batch process script to delete a fenced area?

$
0
0

Hi,

I am having problems with a simple batch process script.

I need to delete some elements in a series of drawings  These items are in my front sheet and I'm trying to batch process it using a fence, then delete fence contents. The i need to insert a series of cells into the drawings.

The insertion of the various cells is OK and working fine.

My problem is when I try the fence delete. It draws then fence, but is waiting for me to confirm, or enter, I guess. Not sure what I'm doing wrong, Can't make the batch file do a 'return' or 'enter' so to speak. 

The commented out part is another area I need to delete some items from.

AA=0
AS=1
selview 1
lock fence inside
place fence block
xy=0.7381,0.4774;xy=0.8266,0.5844
fence delete
null
#place fence block
#xy=0.4916,0.0075;xy=0.6270,0.0293
#fence delete
#null
'Reset to complete
RESET

Thanks

[CONNECT .NET] Get File Branding

$
0
0

I want to get a DGN file's brand (i.e. Its workspace and workset).  I've made some progress...

if (DgnWorkSetInfo.ExistsOnDgnFile(dgnFile))
{
  using (DgnWorkSetInfo info = DgnWorkSetInfo.ExtractFromDgnFile(dgnFile))
  {
    string s = $"Workset name '{info.Name}'";
  }
}

I'd also like to get the workspace name.  Unfortunately, while the MicroStationAPI has IDgnWorkSetInfoPtr->GetWorkSpaceName(), the .NET equivalent doesn't seem to exist.  Have I missed something?

SDK example ../Miscellaneous/CheckWorkSetPaths shows how to do this using C++.

[CONNECT C++] IDgnWorkSetInfo Properties

$
0
0

Class IDgnWorkSetInfo has methods relating to properties...

  • AddProperty (overloaded for several data types)
  • AreAllPropertiesLoaded ()
  • RemoveProperty

But there's no GetProperty().  How can we obtain the properties owned by a DgnWorkSetInfo object?

[.NET SDK] Get Selected Elements

$
0
0

Hello,

I need to get a selected elements via .NET SDK. I've found the method GetSelectedElements, but seems it is only for VBA. 

Please advise how to achieve this using .NET.

Thanks,
Victor.


[C#] Get ECInstance of Element

$
0
0

Hello,

In addition to the topic [.NET SDK] Get Selected Elements, is there a way to get ECInstance knowing an Element? I can get Element of ECInstance (ECInstance.Element), but how to do vice versa?

Open Roads Designer CONNECT Edition - 2020 Release 2 Update 8 - Version 10.08.01.33

Thanks.

[VBA] [V8i] Add Model from source dgn

$
0
0

Good morning everyone,

is it possible add a model (existing in a "source" DGN) as model in a "target" DGN? 

I mean with original content.

If yes, how?

Bye,

Paolo

[MSCE update 13 C++/C#] How can I change the reference visible edges from dynamic to cached by code--NO KEY IN

$
0
0

Hi all,

    Now I want to change the visible edges from dynamic to cached. And I can see the operation from the dialog of reference, but I did not find it from the API for C++/C#

    Can anyone help to find out what the method is. 

    Thanks.

Unit System value

$
0
0

Why is the System value for US Survey Foot set to 1 in the units.def file, but set to 3 in the two different .h files?

V8i - msdefs.h file

#define     UNIT_SYSTEM_Undefined       0

#define     UNIT_SYSTEM_English         1

#define     UNIT_SYSTEM_Metric          2

#define     UNIT_SYSTEM_USSurvey        3   // based on US Survey Foot.

Connect - UnitDefinition.h

enum class UnitSystem

    {

    Undefined   = 0,

    English     = 1,

    Metric      = 2,

    USSurvey    = 3,

    };

Units.def file

#   Valid values for System are:

#   0 Undefined

#   1 US Survey Foot (English)

#   2 Metric

#   3 English (based on International Foot)

Thank you, Donna Rodrick

[CONNECT v8i C#] trim complexstring

$
0
0

Hello,

i would like to trim a complexstring element at a certain point to get the resulting 2 partial complexstring elements.

I have to do this in the .NET Interop API, since the code needs to be ported back to v8i at some point, so using the new .NET API with curves is not possible.

I've tried using PartialDelete, but all this function does in this case, it deletes the first element in the complex string.

e.g. complexstring with arc, spline, line

my chosen trim point is on the line part

PartialDelete removes the entire arc and returns the spline+line as complexstring

Searching the VBA help, MDL programmer guide, mdl api reference and other documents for keywords: trim, break or cut, etc yield nothing

Is there any function where i can simply provide a point on a complexstring element and get the resulting 2 partial elements?

Viewing all 4331 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>