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

[CONNECT .NET] Reverse look-up of XML command

$
0
0

A .NET AddIn often has an XML command table (see the examples delivered with the MicroStation SDK).

That XML file contains a map of command words to a .NET function that implements the command.  For example

<KeyinHandlers>
    <KeyinHandler Keyin="csAddins CreateElement LineAndLineString"
        Function="csAddins.CreateElement.LineAndLineString"/>    
     …</KeyinHandlers>

In the implementation of function LineAndLineString, is it possible to look up the command key-in that invoked it?  That is...

public void csAddins.CreateElement.LineAndLineString (string unparsed)
{ string keyIn = LookUpCommandInXmlTable ();
}

Microstation V8i SDK programming environment (SS10)

$
0
0

I have an MDL application that I originally wrote in V7 that was recompiled into V8i SS2 around 2005 (with slight modifications) by another developer who has since retired.  The Engineering group has requested program updates to an MDL and I've been asked to make those changes.

We are updating our installation to SS10, but I don't have a dev environment any more for v8i, and I've been looking for the SDK and install instructions to set it up.  The last time we had maintenance on these MDLs was in 2012, and that was for v7 changes (we were still using an OLD version of PDS that only ran with v7).

Can someone point me at the right spot to get the SDK / requirements for updating the MDL?  It's been so long since these programs have been touched that I'm not even sure if I should be installing Visual Studio or just use the C++ redistributable to do native MDL programming.

I still have LASolutions links (thanks so much for keeping them active, guys!) but since I don't support Microstation day-to-day, I'm quite out of touch with what needs to be done to set this up again.

Any help would be greatly appreciated.

Gary Shay
Air Products and Chemicals, Inc.

How can I delete a cell definition in cell library by VBA or keyin

$
0
0

Hello All,

I have some dgn files which are converted from dwg, there is no cell library attached, there are many cell defintions in the cell library, I'd like to delete some of them(not all of them, cannot do it by compress design.). Then I can attach another cell library with same cell name. If save cell name in both currrent file and the attached cell library, the one in current file takes higher priority. My final purpose is to reddefine some cells. Or if any other way. Thanks a lot.

SDK installation error

$
0
0

Hi All,

I seem to be having issues installing the SDK, I am running Visual Studio 2017 and Microstation CE update 12. Whenever I go to build all examples i get "BMAKE: Error - Attempting to build with VS 2015 but location is undefined!"

Is there any way that I can specify a different version of VS to build with? In the BDN video they say VS 2015 and up; and I have noticed a few others on the forum are running VS 2017 with no issue so I really don't know what I've done wrong here... Any help would be much appreciated!

Cheers,

Ed

[CONNECT Update 12 C++] Can't build examples

$
0
0

Hi,

Could you help me out, I think it has something to do with my paths. I have installed visual studios professional 2017.

Maybe good to know that I also have an visual studio ultimate 2013 and microstation v8i version installed. 

I followed the youtube videos. 

C:\PROGRA~1\Bentley\MICROS~2\mki\VCVarsQueryRegistry2017.mki(84) : error : Symbol '$' is undefined                      BMAKE: call trace                                                                                                          

line:   84, C:\PROGRA~1\Bentley\MICROS~2\mki\VCVarsQueryRegistry2017.mki                                               

line:  960, C:\PROGRA~1\Bentley\MICROS~2\mki\AssertToolSet.mki                                                         

line:  114, C:\PROGRA~1\Bentley\MICROS~2\mki\ConfigurePolicy.mki                                                       

line:   26, C:\PROGRA~1\Bentley\MICROS~2\mki\mdl.mki                                                                 

line:   14, C:\PROGRA~1\Bentley\MICROS~2\examples\DialogBoxes\BasicDialogBox\BasicDialogBox.mke 

I included the log from generated with "bmake +a -v BasicDialogBox.mke > log1.txt ": 

  communities.bentley.com/.../log1.txt

[CONNECT .NET] DgnDocument.CreateXxx

$
0
0

There are several DgnDocument.Create static methods...

  1. CreateForEmbeddedFile
  2. CreateForLocalFile
  3. CreateForNewFile
  4. CreateFromFileName
  5. CreateFromMoniker

The MstnPlatformNet help is, as usual, terse.  What do those all mean?

To create a DgnDocument for a DGN file on my server, which of those should I use?

Bulk fillet linestring via script file or VBA

$
0
0

I am working on viaduct post tensioning & have managed to plot a 3D smart line for the tendons (~700 done automatically) but I am now trying to add fillets to them via a macro or VBA to bulk fillet each line based on a dynamic radius. For example end segments would have a different radius to all other parts of the line string. As we have a large number of data points doing this manually is not ideal.

Alternatively if there is a way to add this fillet command line to my text file this could also work, this is what I have so far...

Place Lstring

XY=1,2,3
XY=4,5,6
XY=7,8,9
XY=10,11,12
XY=13,14,15
XY=16,17,18
XY=19,20,21
XY=22,23,24
XY=25,26,27
XY=28,29,30

reset

XY=31,32,33
XY=34,35,36
XY=37,38,39
XY=40,41,42
XY=43,44,45
XY=46,47,48
XY=49,50,51
XY=52,53,54
XY=55,56,57
XY=58,59,60

_____
Does anyone know the format to I have to add the arc command in the text file? If I could input the start, mid & end point of the arc that would be a good workaround from having to create a macro.

Cheers,

Jiten

[CONNECT .NET] .DgnFile.LoadDgnFile

$
0
0

When this code runs...

DgnDocument doc = DgnDocument.CreateForLocalFile (filePath);
DgnFileOpenMode openMode = DgnFileOpenMode.ReadWrite;
DgnFileOwner owner = Bentley.DgnPlatformNET.DgnFile.Create (doc, openMode);
StatusInt status = -1;
owner.DgnFile.LoadDgnFile(out status); 

The status is SUCCESS (0). The DGN file is not opened. In addition to DgnFile.LoadDgnFile(), what must I do to make it the active DGN file?  Or should I take a different path completely to open a DGN file?


[CONNECT .NET] Activate DgnModel

$
0
0

Enhancement Request #432451

How's that request progressing (see this thread)?  The missing functionality, a .NET method to activate a DGN model, was reported in the era of Update 5.

[Connect C++] Deleting an ACS

$
0
0

In my model, I have several defined ACS's that I am unable to delete. When I pick one, the "delete" option does not enable. When I try to delete one via code:

StatusInt  iStatus = IACSManager::GetManager().Delete(WString(L"Old Military Grid Coordinates").c_str(), ACTIVEMODEL);
wprintf(L"IACSManager::GetManager().Delete(), iStatus=%d\n",iStatus);

I get a return status of -110 (writeinhibet)

why is it that these ACS definitions cannot be removed? What is holding them?

Bruce

[CONNECT C++] Locating Elements using DgnElementSetTool

$
0
0

When AutoLocate is enabled, as the cursor is moved over elements in the model, those elements are filtered trough _OnPostLocate() where you can accept or reject the element. Is there a function to override BEFORE _OnPostLocate() gets called - like a "_OnPreLocate()"? I wish to set a flag to indicate that there is either a "valid" element for my tool, or not. I can set the flag for "IsValidElement" in _OnPostLocate(), however, as the user moves the cursor "off" the element (prior to a datapoint) I need to "unset" that flag. I'm currently using _OnModelMotion() to "unset" it but I'm wondering if there is a better way to do that, or a better location.

[CONNECT Ribbon] Display Icon for a submenu under DropDownButton SplitButton

$
0
0

I am using a Ribbon containing Splitbuttons and DropDownButtons. Under one of these I want to make a SubMenu with a few MenuItems. Now the SplitButton and DropDownButton each have their appropriate Icons and also the MenuItems have Icons, but the submenu in between doesn't show up with an icon, see image. Althoug in the customize ribbon menu there is an option to attach an icon to the submenu, as soon as you klick Apply the icon is detached.

Is this a bug or is there another way to attach an icon to a submenu? 

Paul

 ~~

[CE U12] How to "unset" AccuDraw LockAngle programmatically?

$
0
0

In my tool, I use AccuDraw::GetInstance().SetContext() to enable an angle lock (ACCUDRAW_LockAngle) at various angles, depending on user tool settings. I have one particular case however, where I need to "remove" that angle lock. In the dynamics function, I use:

				AccuDraw::GetInstance().SetContext((AccuDrawFlags)(ACCUDRAW_LockAngle), nullptr, nullptr, nullptr, nullptr, &angle, nullptr);

where "angle" is the desired lock angle for AccuDraw. I have tried to disable the angle lock by doing this:

				AccuDrawFlags			accuDrawFlags;
				memset(&accuDrawFlags, 0, sizeof(AccuDrawFlags));
				AccuDraw::GetInstance().SetContext(accuDrawFlags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);

but it has no affect - the angle lock remains. Any recommendations on how to free that Angle Lock? Is my only option to totally deactivate AccuDraw?

Thanks,

[CONNECT C++] Issues trying to fill an ellipse

$
0
0

When I create an Arc via DraftingElementSchema::ToElement() I am unable to obtain a valid IAreaFillPropertiesEdit pointer. When I create create a Shape via the ShapeHandler::CreateShapeElement method, I *am* able to obtain a valid IAreaFillPropertiesEdit pointer:

		DPoint3d						center = { 0 };
		DEllipse3d						dot = DEllipse3d::FromCenterRadiusXY(center, 100.0);
		if (SUCCESS != DraftingElementSchema::ToElement(eehPart, *ICurvePrimitive::CreateArc(dot), nullptr, ACTIVEMODEL->Is3d(), *ACTIVEMODEL))
		{
			wprintf(L"Error creating DOT\n");
		}
		// add fill to the DOT
		IAreaFillPropertiesEdit			*fileEditP = dynamic_cast<IAreaFillPropertiesEdit*>(&eehPart.GetHandler());
		if (NULL == fileEditP)
		{
			wprintf(L"Error obtaining fill handler\n");	// maybe becase element is not persistent ?
		}
		else
		{
			UInt32							fillColor = 3;
			bool							alwaysFilled = true;
			if ( !fileEditP->AddSolidFill(eehPart, &fillColor, &alwaysFilled))
				wprintf(L"Error filling ellipse\n");
		}

However, this works:

if (SUCCESS == ShapeHandler::CreateShapeElement(eehArrow, NULL, pts, sizeof(pts) / sizeof(DPoint3d), ACTIVEMODEL->Is3d(), *ACTIVEMODEL))
	{
		IAreaFillPropertiesEdit			*pFill = dynamic_cast<IAreaFillPropertiesEdit*>(&eehArrow.GetHandler());
		bool							alwaysFill = true;
		UInt32							fillColor = 0;
		pFill->AddSolidFill(eehArrow, &fillColor, &alwaysFill);
		// symbolize
		ElementPropertiesSetterPtr		propSetter = ElementPropertiesSetter::Create();
		propSetter->SetColor(0);
		propSetter->SetWeight(0);
		propSetter->SetLinestyle(0, NULL);
		propSetter->SetLevel(m_levelId);
		//propSetter->SetFillColor(0);
		propSetter->Apply(eehArrow);
	}

Is there an issue with the Arc/Ellipse handler returning an IAreaFillPropertiesEdit pointer, or am I going about it in the wrong way?

[CONNECT .NET] Set MicroStation Main Window to Form

$
0
0

My dialog inherits from Windows Form.  I show the dialog using dlg.Show (System.Windows.Forms.IWin32Window owner).

I would like my dialog to be owned by the MicroStation main window.  How do I get a System.Windows.Forms.IWin32Window reference to MicroStation's main window?


[CONNECT .NET] CurveVector

$
0
0

I want to use a CurveVector to calculate an element's length.  Although GetCurveVector() is mentioned in MstnPlatformNet help, the CurveVector class is not defined anywhere that I can find.

Break-line Symbol

$
0
0

Hi All,

I'm currently upgrading our work MicroStation (actually OpenBuildings) to the Connect version.

One of the old legacy tools that we use a lot is for creating a 2d break-line. The way it works you select two points and then it uses the smart-line tool to draw a broken zigzag line with extensions past your points.

 communities.bentley.com/.../2806.S04-100m3-Silo-Slab-Details-1.dgn-_5B00_2D-_2D00_-V8-DGN_5D00_-_2D00_-AECOsim-Building-Designer-V8i-_2800_SELECTseries-6_2900_-_2800_1_2900_-30_5F00_05_5F00_2019-11_5F00_11_5F00_37-AM.mp4 

This is an old .bas macro that has been around longer then I've been alive I think. Anyway with Connect these old .bas files don't work, and i'm a bit of a vba noob so have no idea on how to write a new macro to do what this old tool does 

I'm wondering if there is a tool within MicroStation that does draw a break-line symbol. I seam to remember a break-line tool in an older version of MicroStation (V7) but can't be 100% sure it was a standard tool or a custom tool added in. My current boss also thought there was a standard tool also, but this could be his old age showing.

I was in the local Bentley office a couple weeks ago and brought this up with the guys there, and they also came up blank on this. I’m sort of surprised that there isn't a standard solution to this, as it would be a standard drafting/drawing composition tool like revision clouds. 

I also know that Autocad has a standard break-line tool like this which is also now in Revit.

Anyway, hope someone might be able to point me in the right direction

Dave

[c# CONNECT] get and set annotation scale for references

$
0
0

using COM interop, i add a reference to a dgn model, for some reason the use active annotation toggle is off. So im trying to figure out how to set that. i found this post...

https://communities.bentley.com/products/programming/microstation_programming/f/archived-microstation-v8i-vba-forum/72779/how-to-toggle-attachment-annotation-scale/211784#211784

but it looks like that mdlcall doesnt exist? i keep getting no entry point found.

here is my code 

[DllImport("stdmdlbltin.dll")]
public static extern long mdlRefFile_getParameters(long name, ref long paramName, long modelRef);
[DllImport(@"C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\stdmdlbltin.dll", CharSet = CharSet.Unicode)]
public static extern int mdlRefFile_setParameters(ref int param, ref int paramName, ref int modelRef);


                                        Bentley.Interop.MicroStationDGN.Application MSApp = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
                                        Bentley.Interop.MicroStationDGN.DesignFile curfile2 = MSApp.OpenDesignFileForProgram(collectorPath, false);

                                        Bentley.Interop.MicroStationDGN.Attachment newAtt = curfile2.Models[1].Attachments.AddCoincident1(Path.GetFileName(fullpath), "Design", "", curFile.propComments, Bentley.Interop.MicroStationDGN.MsdAddAttachmentFlags.CoincidentWorld);

                                        newAtt.NewLevelDisplay = Bentley.Interop.MicroStationDGN.MsdNewLevelDisplay.Always;
                                        
                                        newAtt.DisplayFlag = true;
                                        newAtt.Rewrite();
                                        
                                        curfile2.Save();
//********this is the section of code im asking about
                                        //Get annotation scale current value
                                        int lUseAnnotationScale = 0;
                                        long REFERENCE_USEANNOTATIONSCALE = 71;
                                        long mdlmodelRefP = newAtt.MdlModelRefP();
                                        //long rtc = mdlRefFile_getParameters(lUseAnnotationScale, ref REFERENCE_USEANNOTATIONSCALE, mdlmodelRefP);
                                        if(lUseAnnotationScale == 0)
                                        {//already set

                                        }
                                        else
                                        {//need to set
                                            //rtc = mdlRefFile_setParameters(ref lUseAnnotationScale,ref REFERENCE_USEANNOTATIONSCALE, ref mdlmodelRefP);
                                            newAtt.Rewrite();
                                            curfile2.Save();
                                        }

[DllImport("stdmdlbltin.dll")]
public static extern long mdlRefFile_getParameters(long name, ref long paramName, long modelRef);
[DllImport(@"C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\stdmdlbltin.dll", CharSet = CharSet.Unicode)]
public static extern int mdlRefFile_setParameters(ref int param, ref int paramName, ref int modelRef);


                                        Bentley.Interop.MicroStationDGN.Application MSApp = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
                                        Bentley.Interop.MicroStationDGN.DesignFile curfile2 = MSApp.OpenDesignFileForProgram(collectorPath, false);

                                        Bentley.Interop.MicroStationDGN.Attachment newAtt = curfile2.Models[1].Attachments.AddCoincident1(Path.GetFileName(fullpath), "Design", "", curFile.propComments, Bentley.Interop.MicroStationDGN.MsdAddAttachmentFlags.CoincidentWorld);

                                        newAtt.NewLevelDisplay = Bentley.Interop.MicroStationDGN.MsdNewLevelDisplay.Always;
                                        
                                        newAtt.DisplayFlag = true;
                                        newAtt.Rewrite();
                                        
                                        curfile2.Save();
//********this is the section of code im asking about
                                        //Get annotation scale current value
                                        int lUseAnnotationScale = 0;
                                        long REFERENCE_USEANNOTATIONSCALE = 71;
                                        long mdlmodelRefP = newAtt.MdlModelRefP();
                                        long rtc = mdlRefFile_getParameters(lUseAnnotationScale, ref REFERENCE_USEANNOTATIONSCALE, mdlmodelRefP);
                                        if(lUseAnnotationScale == 0)
                                        {//already set

                                        }
                                        else
                                        {//need to set
                                            //rtc = mdlRefFile_setParameters(ref lUseAnnotationScale,ref REFERENCE_USEANNOTATIONSCALE, ref mdlmodelRefP);
                                            newAtt.Rewrite();
                                            curfile2.Save();
                                        }

How to find the offset of a reference file.

$
0
0

I am trying to find any object that will send me back the offset of a reference file with mvba code. 

I can easily calculate for the rotation and the Attachment.MasterOrigin gives the resultant location after the offset is applied, but I am trying to figure out essentially what the MasterOrigin would be if the file was not rotated and offset.

[MDL V8i SS10] BMake Error in Source during compile, trouble finding .H files in folder %MS%\MDL\Include

$
0
0

I am recompiling a currently working MDL application for SS10, using the SS4 SDK provided by Bentley Support.  Was able to configure all that no problems, I think.

I have changed the environment variables for the system to the suggested settings.  The BMAKE starts with no issues, including the various .MKI files properly, but when compiling the resource file for the command - in the cmd.r file - the includes are as follows:

#include <rscdefs.h>
#include <cmdclass.h>
#include <english\liqditxt.h>  // << this is an application file

I get the following result:

C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\bin\rcomp @make.opt
MicroStation Resource Compiler 08.11.09
d:\mdl\liqdist-v8\ldistcmd.r(24) : error: can't open #include file rscdefs.h
d:\mdl\liqdist-v8\ldistcmd.r(24) : error: No such file or directory
d:\mdl\liqdist-v8\ldistcmd.r(25) : error: can't open #include file cmdclass.h
d:\mdl\liqdist-v8\ldistcmd.r(25) : error: No such file or directory
d:\mdl\liqdist-v8\ldistcmd.r(41) : error: 'Table': syntax not recognized
There must be at least 1 resource defined. Aborted.

The two files that it can't find are definitely in the path included in BMAKE_OPT.  I think it's a path issue within bmake - it's not finding rscdefs.h in the application's folder, so it's not looking in the general MDL Include folder per the SDK.

I did bmake using the option +p, so I can see where paths for the .MKIs have all resolved, but I think I might need to add something to the MKE file to identify the include path.  make.opt shows several include macros, but I'm just not seeing where the gap is.

BMAKE_OPT=-IC:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\include -IC:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\include\stdlib

MS=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\
MSMDE=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\;C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\bin;C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\library;C:\Program Files (x86)\PDFtk Server\bin\PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

MLINK_STDLIB=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\library\builtin.dlo

PolicyFileMapMki=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\include\MdlSdkPolicyFileMap.mki
PolicyFileNamesMki=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\include\MdlSdkPolicyFileNames.mki

toolspath=C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdl\bin\

Any and all help is greatly appreciated.

Viewing all 7260 articles
Browse latest View live


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