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

[CONNECT U14 C#]

$
0
0

How can I get all models from a dgn file?

Currently, if I get a model using Bentley.DgnPlatformNET.DesignFile.LoadRootModelById(out status, currentLoadedModelIndex.Id, true, true, true) then it throws exception as in attachment.


[CONNECT U10 C++]

$
0
0

I am trying to use an existing C# library from an  MDL application.  When I try to load the MDL application after adding code to instantiate an object from the library, I get the "MicroStation has stopped working." dialog.

Here is the MDL code from a test application I created to try to determine the problem:

#include    <Mstn\MdlApi\MdlApi.h>         /* Basic MDL functions, constants & structures */
USING_NAMESPACE_BENTLEY

// .NET Forms
#using <System.dll>
#using <System.Windows.dll>
#using <System.Windows.Forms.dll>

// C# class library
#using <ClassLibrary1.dll>

extern "C" DLLEXPORT void	MdlMain ( int    argc, WCharCP	argv[])
{

    mdlOutput_command (L"TEST...");            
	System::Windows::MessageBox::Show("TEST - START.");
	// Create object using from C# library:
	ClassLibrary1::Class1 cSharpTest;
	cSharpTest.test();
	System::Windows::MessageBox::Show("TEST - OVER.");
	return;
}      

This is the C# class I am trying to use:

using System.Windows.Forms;
namespace ClassLibrary1
{
    public class Class1 
    {
        public void test()
        {
            MessageBox.Show("C# Test");
        }
    }
}

Here is the .mke file:

#************************************************************************
#	MDL Make File for the TEST MDL Application
#
#************************************************************************

PolicyFile = MicroStationPolicy.mki
DEFAULT_TARGET_PROCESSOR_ARCHITECTURE=x64
MDLMKI = $(MSMDE)mki/
mdlLibs = $(MSMDE)library/
dirToSearch = $(MDLMKI)


%include $(MDLMKI)mdl.mki
%include $(MDLMKI)cincapnd.mki

appName = test
sAppName = test
dllName = test
libname = test

DLMLINK_WARNINGS_AS_ERRORS=1

baseDir		    = ./
libSrc		    = ${baseDir}/source/
privateInc      = ${baseDir}/header/
langSpec	    = ${baseDir}/transkit/
libRsc			= $(baseDir)/resource/

#---------------------------------------------
# Pass the folders to our include files to the 
# Microsoft CPP compiler, so it can find out
# include files. 
#---------------------------------------------
MDLINC = $(MSMDE)include/
altIncs         = -i$(MDLINC)  -i$(privateInc) -i$(langSpec)
cIncs           = -I${MDLINC}  -I${privateInc} -I${langSpec}

#---------------------------------------------
# If specified, pass the various options to the compiler
#---------------------------------------------
%if debug
    compOpts + -ddebug
%endif

%if VERBOSE_DEBUG
   compOpts + -dVERBOSE_DEBUG
%endif

%if BUILD_VER
	libOut		= $(baseDir)/builds/$(BUILD_VER)/
%else
	libOut		= $(baseDir)/builds/xm/
%endif

o = $(libOut)

%if UserCompOpts
   compOpts + $(UserCompOpts)
%endif

libObjs = $(libOut)test${oext}

linkLibs = $(mdlLibs)bentley.lib
linkLibs + $(mdlLibs)BentleyAllocator.lib
linkLibs + $(mdlLibs)DgnPlatform.lib

appResources = $(o)$(appName)dll.rsc

#----------------------------------------------------------------------
#   Verify existence of required output directories.
#----------------------------------------------------------------------
$(o)$(tstDir)		: $(o)$(tstDir)

$(buildOut)$(tstDir)    : $(buildOut)$(tstDir)


#---------------------------------------------
#       make dll resource
#---------------------------------------------
$(o)$(appName)dll.rsc        : $(libRsc)$(appName)dll.r

%include $(MDLMKI)compileForCLRStart.mki
csharpdll = "C:\MDL_Source\ConsoleApplication2\ClassLibrary1\bin\Debug"
CCompOpts + -AI$(MS)assemblies -AI$(assemblies)ECFramework -AI$(MS) -AI$(o) -AI$(csharpdll) -DDEBUG
$(libOut)test.obj : $(libSrc)test.cpp ${MultiCompileDepends}
%include $(MDLMKI)compileForCLRStop.mki

#------------------------------------------------
DLM_NAME            = $(dllName)
DLM_DEST            = $(mdlapps)
RIGHTSCOMPLIANT             = true
DLM_OBJECT_DEST     = $(o)
DLM_OBJECT_FILES    = $(o)$(appName).obj
DLM_LIBDEF_SRC              = $(_MakeFilePath)
DLM_NO_DEF          = 1
DLM_NO_DLS          = 1
DLM_NOENTRY         = 1
DLM_NO_INITIALIZE_FUNCTION  = 1
LINKER_LIBRARIES     = $(linkLibs)
DLM_OUT_NAME        = $(libOut)/$(appName).dll  # placing the dll in the appropiate folder
DLM_SYMB_NAME       = $(libOut)/$(appName).pdb  # placing the debug symbols in the appropiate folder.
DLM_NO_MANIFEST         = 1             
DLM_NO_SIGN             = 1             
DLM_SPECIAL_LINKOPT = -Fixed:no

ASSEMBLY_VERSION            = 1.0.0.0
ASSEMBLY_FILE_VERSION       = 1.0.0.0
ASSEMBLY_TITLE              = $(appName)
ASSEMBLY_DESCRIPTION        = $(appName)
ASSEMBLY_PRODUCT_NAME       = $(appName)
ASSEMBLY_COMPANY_NAME       = USACE
ASSEMBLY_COPYRIGHT          = (c) USACE. All rights reserved.

#----------------------------------------------------------------------
ASSEMBLY_RES_TO_ADD_DIRECTORY = $(baseDir)
%message $(ASSEMBLY_RES_TO_ADD_DIRECTORY)
%include $(MDLMKI)linkMixedAssembly.mki

#---------------------------------------------
#   Generate application code file and intermediate application file
#---------------------------------------------
$(libOut)/$(AppName).ma		: $(appResources)
	$(msg)
	> $(o)make.opt
	-o$@
	$(appResources)<
	$(RLibCmd) @$(o)make.opt
	~time

Any idea why this doesn't work?

Thanks for your help.

[C++] BMake emit message

$
0
0

How do I instruct bmake to issue a message to the build log while building a project? 

I tried this but it objects...

@echo Comment

How make macro to place text "element level name" on element ?

$
0
0
I would like to make a macro to place on a line that we click the name of the level of the line.

Getting Started with MicroStation SDK and Visual Studio 2017

$
0
0

Ok So I have installed MicroStation CE Update 13

I have Visual Studio 2017 Pro with relevant add-ins.

I have installed the MicroStation CE Updated 13 SDK.

And then I get stuck....on getting up and running

The only included documentation in the latest SDK is 6 year out of date and incomplete and does not work.

The only u-tube video on the subject is out of date and does not work.

I cannot find anything on the learn server.

So how do I get started here?

Does any one have step by step instructions on how to get Visual Studio 2017 working with MicroStation and the SDK from the point of installation of the apps and the SDK?

Any help gratefully received.

With Hope

Stephen Holmes

C# Add-In Examples

$
0
0

I just posted some sample Add-Ins to my Github site: https://github.com/DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise/tree/master/Samples/MSCE-AddIns

You'll need MostOfDavesClasses.cs from the root of the site to build them. The samples are: SetPWVarsCE (adds your ProjectWise document general properties and custom attributes as configuration variables in your current session), PolyhedraCE (an update of my old Polyhedra example for CE), and QRCodeAddInForMSCE which creates a QR Code cell which you can place in your drawing. Pass the URL you want to encode on the command line. It's a pretty good Primitive placement example I think.

Fonts used on MDL form

$
0
0

I have a mdl developer that is creating applications that uses forms with text on them.  When I load them the text font I see are different then what he sees.  Does MDL have a way to set the fonts it uses on the forms so we both see the same thing?

Border around grouping is not showing right below yellow hilited section

How to Report Element Information per Level - Line Style Scale?

$
0
0

I'm looking for a way to QUICKLY check or verify proper Line Style scale values.

Currently, we select all elements of a given level, then go into the Element information tool [ Element Information>Extended>Line Style Parameters>Scale ] to check the scale. If it returns as "Varies" or some other value, we fix it. Then REPEAT for every single level.... tedious.

I was wondering if there was a way to report this easily in a .CSV or Excel file?  

Sample desired output:

Level,LineStyleScale,ElementCount

Roads,50.00,25

Shoulders,varies,12

Buildings,50.00,132

SignLine,25.00,4

In a table format like this, even with DOZENS of levels, I could visually scan that list in seconds to see which (if any) elements need to have closer review, or scale fixed.(In the example above, all Levels should be scale of 50.00.  So I immediately know that I need to fix Shoulders and SignLine.)

We are using MicroStation v8i primarily, but do have access to Connect if needed... I can get the Connect Reports tool to list each USED LEVEL in the DGN, but cannot add a column that exposes the Line Style Parameter value as seen in the  Element Information dialog.

Any help is appreciated.


MDL Multicolumn combobox

$
0
0

Within one of our MDL applications, we have a dialog containing a combobox that has a multicolumn list model.

Selecting an item from the list, the (readonly) textedit only shows the first column of the selected item.

Is there a way to include also the other columns in the textedit?

Thanks,

Robert Kock

Attribute ID

$
0
0

I have requested for Attribute ID to run microstation VBA programs. It is a while and I am waiting. Any idea how long it takes?

[CE U12 VBA] Dimension Element Primary Text Property

$
0
0

I've migrated a VBA macro from V8i to CE Update 12 that places dimension elements. 

In the V8i version this statement works without a problem to place the automatic text for the dimension element

            elDim.PrimaryText = "*"

In CE U12 I get this error on the same statement.

If I replace the * with any other text value the statement works without a problem.

            elDim.PrimaryText = "Dim Value"

Is this a defect in CE, or is there a new way to enter specify automatic text in a dimension element?

Index of chosen color with DItem_ColorPickerRsc

$
0
0

Within a MDL application I have a dialog that contains a ColorPicker.

It shows as a button whose color reports the chosen color.

I would like this button to report the index of the chosen color. Is there a way to do so?

My resource file contains the following:

DialogBoxResource .... =

{

  .....

  {{ 83.5*XC, 4.5*YC, 10*XC, 1.5*YC}, ColorPicker , COLORPICKERID_TextColor , ON, 0, TXT_Colore, ""},

  ....

}

DItem_ColorPickerRsc COLORPICKERID_TextColor =
{
NOCMD, LCMD, NOSYNONYM, NOHELP, LHELP,
NOHOOK, NOARG,
0, 0xFFFF,
"",
"textColor"
};

[CE U12 VBA] Updating Text Style properites

$
0
0

I'm having an issue with updating text style properties on text elements. I've included an old Bentley macro that works in V8i, but does not set the correct text size in CE U12.

communities.bentley.com/.../LineCreatePerLevel.mvba

'*---------------------------------------------------------------------------------**''**' @description      Creates the text elements' @param            oLevel              IN the Level object we are creating the line for' @param            INISettingsArray()  IN the string array of settings' @param            dblLineOrigin       IN the start vertice for the line element' @return' @version          1.0' @dependencies' @example          TextCreate oLevel, INISettingsArray(), LineVerts(0)' @remarks' @alinkjoin' @group' @bsimethod                                                    BSI-DEVSPT      08/05'---------------+---------------+---------------+---------------+---------------+------''
Sub TextCreate(oLevel As Level, INISettingsArray() As String, dblLineOrigin As Point3d)
    Dim TextOrigin  As Point3d
    Dim oText       As TextElement
    CadInputQueue.SendKeyin "TX=" & INISettingsArray(1)' Set the text origin as per the INI and the line start point
    TextOrigin.X = dblLineOrigin.X
    TextOrigin.Y = dblLineOrigin.Y + Val(INISettingsArray(2))' Create the text
    Set oText = CreateTextElement1(Nothing, oLevel.Name, TextOrigin, Matrix3dIdentity)' Set the level
    oText.Level = oLevel' Set the justification to left center
    oText.TextStyle.Justification = msdTextJustificationLeftCenter' Set the text size as per the INI
    oText.TextStyle.Height = Val(INISettingsArray(1))
    oText.TextStyle.Width = Val(INISettingsArray(1))' Add the text element to the model
    ActiveModelReference.AddElement oText
End Sub

In the example sub I had to add the CadInputQueue.SendKeyin "TX=" & INISettingsArray(1) at the beginning of the sub to get the correct text size. The two lines at the end of the sub to set the Text Height and Width properties no longer have any affect on the new text element placed in the model.

[CE U13 C++] Missing function GetRangePlanes()

$
0
0

Hi all!

We migrate from V8i project and got a problem with function ViewContext::GetRangePlanes()
This function exists in header ViewContext.h:

//! Get the clip planes that define the limits of the displayed volume.  This will include
//! planes for the top,bottom,left and right sides of the view and optionally the front
//! and back planes if they are enabled.
//! @return the clip planes set.
DGNPLATFORM_EXPORT ClipPlaneSetCP GetRangePlanes () const;

In V8i everything is OK, this function exists in library MDLBLTIN.lib
But in CONNECT version compiler can not find this function in CONNECT library with same name
It shows next message

Creating library C:\Users\...\objects\rein.lib and object C:\Users\...\objects\rein.exp
rein.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct Bentley::ClipPlaneSet const * __cdecl Bentley::DgnPlatform::ViewContext::GetRangePlanes(void)const " 
(__imp_?GetRangePlanes@ViewContext@DgnPlatform@Bentley@@QEBAPEBUClipPlaneSet@3@XZ) 
...
C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\rein.dll : fatal error LNK1120: 1 unresolved externals


We looked for this function in all libraries and can not find

Is this a dead end? :)

Using vba to determine which model is the default

$
0
0

I am trying to use VBA to rename the Default model within a series of existing dgn files, however I can find no way to isolate it.

The only obvious difference between the Default model and the other models is that the Default model cannot be deleted.

I could find the Default model in a file by deleting each model in turn to see if it throws an error, then undo the deletion if it doesn't.

The one that throws the error is the default, but that's a pretty crude way to do it.

Because the Models Dialog box tool bar grays out the Delete command when the Default model is selected, there is obviously some way to isolate it.

Can someone please advise how to do it cleanly.


[CONNECT C++] DgnECInstance.Delete causes internal error

$
0
0

My app has a command that successfully attaches an Item Type instance to an element.  Another command should detach an instance from an element...

bool ElementItemDeleter::Remove (EditElementHandleR eeh, DgnModelRefP modelRef /* ACTIVEMODELREF */) const
{
  DgnECInstancePtr instance;
  if (ItemTypes::IsTagged (libName_.c_str (), itemTypeName_.c_str (), instance, eeh))
  {
    DgnECInstanceStatus status { instance->Delete () };
    return DGNECINSTANCESTATUS_Success == status;
  }
  return false;
}
bool ItemTypes::IsTagged (WCharCP              libName, 
                         WCharCP               itemTypesName, 
                         DgnECInstancePtr&     instance, 
                         ElementHandleCR       eh)
{
  CustomItemHost itemHost (eh);
  instance = itemHost.GetCustomItem (libName, itemTypesName);
  return instance.IsValid ();
}

The first time that method ElementItemDeleter::Remove is called, the DgnECInstance::Delete() method causes an error...

Internal Error: Access Violation

The app. remains loaded.   After the first abort, the method works on the second and subsequent invocations. If I remove the Delete() method then there is no problem (except that the instance is not deleted). 

Am I calling the Delete() method incorrectly?  Is there something under the hood that I should be anticipating (e.g. initializing something global)?

Microstation connect

$
0
0

We have developed some MDL Applications using Pseudo code in V8.
As our management decided to purchase Microstation Connect Edition beginning of Jan 2021. (Budget problems)
In order to save time, Can we do the MDL migration in two stages,
Stage 1 (During 2020): From MDL C to native code (C++) using VS 2005
Stage 2 (During 2021): Migrate VS 2005 to VS 2017 in Connect SDK.
Will it be a time consuming process to do Migration in 2 stages?
What is the effort required in Stage 2 when compared to Stage 1.
Will it be a minimum effort when comparing to Stage 1?
Note:
Based on the previous post discussions, I have successfully migrated sample MDL Applications in V8i
(pseudo code to Native code using Visual Studio 2005).

And also i would like to know how to implement c#.net application in microstation connect.

Iif any examples or steps available please let me know

Regards

Saravanan

Microstation connect

$
0
0

We have developed some MDL Applications using Pseudo code in V8.
As our management decided to purchase Microstation Connect Edition beginning of Jan 2021. (Budget problems)
In order to save time, Can we do the MDL migration in two stages,
Stage 1 (During 2020): From MDL C to native code (C++) using VS 2005
Stage 2 (During 2021): Migrate VS 2005 to VS 2017 in Connect SDK.
Will it be a time consuming process to do Migration in 2 stages?
What is the effort required in Stage 2 when compared to Stage 1.
Will it be a minimum effort when comparing to Stage 1?
Note:
Based on the previous post discussions, I have successfully migrated sample MDL Applications in V8i
(pseudo code to Native code using Visual Studio 2005).

Regards

Saravanab

Need Custom Traversing/Cogo MicroStation Tool

$
0
0

I need to find or develop a custom tool that a MicroStation user can use to draw consecutive lines and tangent and nontangent curves easily.  Accu draw is to cumbersome because you have to move from field to field, use your mouse to indicate direction of curves and use alpha characters for the bearings. The InRoads traverse tool is also cumbersome. In Autocad I could draw property lines from a deed or plat with just the 10 key pad by using numbered quadrants for northeast or southeast bearings, type in the bearing with no symbols and then use positive or negative radii for tangent curves. Way faster then anything I can find in MicroStation.  Does someone have a tool or solution I should look into? Or do I need to learn something like MVBA or something else to write my own tool?

[MS CE U12 MVBA] item sets array property

$
0
0

Hello,

 I do not find any way to access the members of an array property

In the example below I would like to set  the value for "Code Technique[0]"

Many thanks

Remy

Viewing all 4331 articles
Browse latest View live


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