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

VBA interface error: failed creating the comp manager - 0x80040583 V8i SS10

$
0
0

We have started experiencing the below error when trying to run any sort of VBA procedure from MicroStation V8i SS10 (08.11.09.908)

VBA interface error: failed creating the comp manager - 0x80040583

We did have it working with V8i SS10 for a short term (couple of days) until a Windows "Security" update seemed to have broken it. I got our IT department to roll back the update which did not help. I then got a fresh PC without that update installed and it still did not work.

I have read this article on the Communities

https://communities.bentley.com/products/microstation/w/microstation__wiki/10631/vba-interface-error-failed-creating-the-comp-manager---0x80040583

I have downloaded the latest Pre Req pack that i could find from the Bentley Website (visualizationcontent081109451en.msi) but after installing and rebooting it does not change.

Due to Bentley's support dropping for older SELECT versions i am trying to test our CAD Build with SS10 but cant do any sort of testing as it wont load our VBA programs.

Any help would be greatly appreciated.


[CONNECT C++] Loop TextFields in existing text element and then get field properties and set field Properties?

$
0
0

Could anyone offer any help with how to do this? I see a TextFieldDictionary in the API. but not really sure how to implement this.

what im trying to do is for a given text element get all the text fields that are linked to a property of a item type. as well as change what property that field is linked to.

I used the code from Yongan.Fu in post https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/180135/msce-c-textblock to create a text field but that's pretty much the only example of textfields I could find.

JD

Description in Reference.

$
0
0

thanks to all,

I want to update ( Rename ) Description with new name " Aligned with Master File " by macro OR VBA.

[ we can update manually for one sheet, but we need micro OR VBA to update for multiple files by batch process ]

 

 

i make below macro but its going to "dialog reference open" after that macro is not working.

Sub main
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint

' Coordinates are in master units
startPoint.x = 0.299829#
startPoint.y = 0.050939#
startPoint.z = 0.000000#

' Send a data point to the current command
point.x = startPoint.x
point.y = startPoint.y
point.z = startPoint.z
MbeSendDataPoint point, 1%

' Start a command
MbeSendCommand "DIALOG CMDBROWSE "

' Send a keyin that can be a command string
MbeSendKeyin "dialog reference open"

' When a command brings up a modal dialog,
' a later statement must close the dialog,
' or the MbeState.modalDialogByUser property
' should be set to 1 so that the user must close
' the dialog when the macro is executed.
' Also, you may not use the debugger "Step"
' commands while a modal dialog is displayed.

' Opened modal dialog "Attachment Settings: ngd00.bor"

' Closed modal dialog "Attachment Settings: ngd00.bor"

' Following comment is the command to close a modal dialog
' MbeSendCommand "MBE1 CLOSEMODAL OK"

MbeSendKeyin "dialog reference close"

MbeSendKeyin "choose element"

MbeSendCommand "SAVE DESIGN "
End Sub

 

[CONNECT .NET] Interface ClosedElement

$
0
0

I want to use interface ClosedElement to measure the properties of DGN shape. ClosedElement is a member of class Element in the InterOpBentley.Interop.MicroStationDGN.  When I get an element by enumerating a DGN model I get an Element from the DgnPlatformNet namespace.  Viz Studio says those are different types, so I have to cast...

void Mensurate (Bentley.DgnPlatformNET.Elements.Element el)
{
  Bentley.Interop.MicroStationDGN.Element el2 = (Bentley.Interop.MicroStationDGN.Element)el;
  ClosedElement ce = el2.AsClosedElement();
  if (null != ce)
  {
    ... take area measurements
  }
}

The above lines compile OK.  At run-time, MicroStation hangs and eventually crashes.

 I'm writing C# and would prefer not to have to call a method using an InterOp.  Does anyone have a better way to use the ClosedElement interface?

Connect vba text element like insert field wordprocessor in cell

$
0
0

Hello,

I have created a cell with a line and field in wordprocessor "f (x)"> element properties> Origin> Y> 0.12.

This cell is saved in the library and inserted in the drawing.

Can I somehow change the cell accuracy inserted in the drawing from 0.12 to 0.123 using vba? I know how to choose a cell with an elementenumerator, but I do not know how to change the accuracy argument ... Second question - Is it possible to create a cell like this with vba macro?

Label Line Options: Length Angle

$
0
0

I'm labeling lines with Bearing & Distance. The format of the Angle & Length are fine, but the output option don't include "Angle Length". Is there a VBA option to change the output?

ex: MsdDimLabelLineFormatAngleLengthAbove

[CONNECT/C++] Enable background color in color picker resource (DItem_ColorPickerRsc)

$
0
0

Does anyone know if it's possible to enable the background color (BK or Color 255)  on a standard dialog color picker item (DItem_ColorPickerRsc) ?

The MicroStation Home->Attributes picker has BK/255 enabled:

But my dialog color picker is limited to color 254:

Changing the Transparency Settings of Levels with VBA / Connect Edition

$
0
0

An article has previously been posted about setting the transparency for a level in v8i.  See link below.

https://communities.bentley.com/products/microstation/w/microstation__wiki/22376/changing-the-transparency-settings-of-levels-with-vba

I want to do the same in Connect Edition.

===================

Public Declare PtrSafe Function mdlLevel_getTransparency Lib "stdmdlbltin.dll" (ByRef transparencyOut As Double, ByVal modelRefIn As Long, ByVal levelIdIn As Long) As Long
Public Declare PtrSafe Function mdlLevel_setTransparency Lib "stdmdlbltin.dll" (ByVal modelRefIn As Long, ByVal levelIdIn As Long, ByVal transparencyIn As Double) As Long

Sub levelTransparency()

  Dim oLv As Level
  For Each oLv In ActiveDesignFile.Levels

    If Not oLv.IsFromLevelLibrary Then
      mdlLevel_setTransparency ActiveModelReference.MdlModelRefP, oLv.ID, 0.4 ' Transparency between 0 and 1

  End If
  Next
  ActiveDesignFile.Levels.Rewrite

End Sub

===================

Have modified the Declare statement with PtrSafe.

Any help appreciated.


[CONNECT .NET] No API for Reports

$
0
0

The .NET API lacks any support for MicroStation Reports.  The C++ MicroStationAPI provides ways to create a Report definition (e.g. class ReportDefinitionNode) but I don't see the same for .NET.

Perversely, the C++ MicroStationAPI documents a managed ReportsExample...

ManagedAutoTagElementExample demonstrates three MicroStation concepts.

  • Item Types: Creating item types and attaching them to elements.
  • Reports : Generating Reports from item types.
  • Text Table: Generating Text Table from a report.

Unfortunately the Viz Studio .NET project delivered with the SDK omits all mention of Reports.

[CONNECT C++] update text element

$
0
0

this is probably a dumb question but...im still learning/grasping on the c++ api works, im used to vba and C#, to update an element there was always .redraw.

i have a text element that i added a field to. but now i need to redraw the text element to the model. looking through the examples for text they all place new elements or just change properties...want to make sure im doing it correctly.

i saw there is a RedrawElems but thats for dynamics .. i see a ReplaceInModel method in the EditElementhandle. but i dont think thats what i want.

looking at the TexthandlerBase i see a ReplaceTextPart. this is what im currently thinking is the way to go. but just want to check if thats correct. have not tested it yet, want to make sure im going in the right direction.

thanks

[V8i C#] Active depth between clip front/back

$
0
0

I'm currently in the progress of trying to make an application, that handles clip columes and clip front/back, but i have a major problem when it comes to the active depth on the clip front/back view.

I've set the active depth using the SetActiveDepthByPoint method, and whenever i query bentley to check if it's correct, it shows an active depth that is bang on in the middle between my display depth. But when i then try to draw something without snapping(this should then drawn on the active depth layer), everything i draw is drawn near y=0.

When i then try to set the active depth using bentleys own tool for it inside the window, everything works fine.

Anyone have a solution for this?

Does V8i support .Net 4.6 framework?

$
0
0

I have an Addin programm, that is under .Net 3.5 compiled and could be running under V8i.

But wenn I change to .Net 4.6.2, it could not be loaded in V8i any more. Why? Does V8i not support .Net 4.6?

[CONNECT c++] get EC instance of itemtype on element?

$
0
0

    //Link to a Property on this element
	ElementId elemIdLink = ElementIDLink;
	ElementHandle elemLink(elemIdLink, pActiveModel);
	if (!elemLink.IsValid())
	{
		return false;
	}
	ElementECClassInfo ecClassInfo2;
	DgnECManagerR ecManager = DgnECManager::GetManager();
	ecManager.FindECClassesOnElement(elemLink.GetElementRef(), ecClassInfo2);
	//how would i loop ecClassInfo2 to find the item type i want?
	//need to figure out how to get classes
	ecManager.FindInstanceOnElement(elemLink, ecClass2); //this is wrong

trying to figure out how to do this..

I need to get the ec instance of an item type instance that is attached to an element.

I need this to add a text field to a text element via TextField::CreateForElement.

im struggling on how to do that...

Microstation Basic Macro

$
0
0

I created a Microstation Basic Macro to attach a reference file (e.g. border sheet) to multiple files in a folder. The macro runs perfect except that the Reference Attachment Settings dialog pops up and I have to click the "OK" tab for every file on the list. Is there a way to automate this or add line into the Macro so I don't have to hit the 'OK' tab? If there is, what should be the Microstation basic command I should add into the macro.?

 macro?

VBA interface error: unable to run macro - invalid procedure name

$
0
0

Hello,

I have a new laptop with windows 10 and MicroStation 08.11.09.908 installed.

On my old laptop, with windows 10 and MicroStation selectseries 4, this VBA did run correctly.

Now I get this error message, what is the problem / solution?

greetings,

Johannes


[CONNECT C#] pass WCharCP into c++ wrapper?

$
0
0

so since I don't have access to adding text fields in c# I made a C++ dll that exports the function to c so I can call it in c#. Problem is I don't know how to pass WCharCP type into the function as a parameter. Really I just need to pass in a string.

I was thinking I could pass a string and then convert it in the c++ method but I don't know how to do that. So not really sure what I should pass. I was thinking wchar_t and then get that to a WCharCP.

something like this...(not sure if that's correct)

[DllImport("Test.dll", CharSet = CharSet.Unicode)]
private static extern bool AddField(Int64 ElementIDText, Int64 ElementIDLink, [In, MarshalAs(UnmanagedType.LPWStr)]string AccessString);

then in the  C++ method

bool AddField(__int64 ElementIDText, __int64 ElementIDLink, wchar_t AccessString)
{
//get AccessString to WCharCP
WCharCP ITProperty = AccessString; //not sure how to do this.
//...
}

any help?

Script to place parametric cells

$
0
0

Hello,

I was just wondering if it is possible to place parametric cells in a model via VBA script which is also linked to a excel file so i can control the location(origin) of a specific parametric cell by changing the values on my excel file (Northings, Eastings etc).

I am using Microstation Connect Edition Update 12 - Version 10.12.00.40

[CONNECT C#] LocateCriteria restrict to certain attachment?

$
0
0

Is there a way to set up locate criteria to only allow selection of an element from a certain attachment?

i know the willmodifyelements boolean needs to be set to false in order to select elements from attachments, but i want to only allow selection from one reference (so no elements in the active model or elements in other references then the one in particular).

is this possible?

thanks

JD

C++ Scanning File issue

$
0
0

I have a strange problem when scanning a file.  In the code below I am looking for cells with name beginning with characters "XX".  It finds all the cells which start with characters "XX" except cell: XXDWG.   Now if I comment out the 3 lines above the line mdlScanCriteria_setElementTypeTest(scP, NULL, sizeof(typeMask));  and uncomment that line it works!  I don't understand why that piece of code wont find XXDWG but find other similar cells like XXMAIN, XXTIT1, XXSHT, etc.  I have tried compressing the file but it does not help.

scP = mdlScanCriteria_create();
	status = mdlScanCriteria_setReturnType (scP, MSSCANCRIT_RETURN_FILEPOS, FALSE, TRUE);
	memset(typeMask, 0, sizeof(typeMask));

	typeMask[0] = TMSK0_CELL_HEADER;
	typeMask[4] = TMSK4_MICROSTATION_ELM;
	mdlScanCriteria_setElementTypeTest (scP, typeMask, sizeof(typeMask));
	//mdlScanCriteria_setElementTypeTest(scP, NULL, sizeof(typeMask));

	eofPos = mdlElement_getFilePos ( FILEPOS_EOF, NULL);
	modelRef = mdlModelRef_getActive();
	mdlScanCriteria_setModel (scP, MASTERFILE);
	filePos = 0L;
	actualPos = 0L;
	do
		{
		scanWords = sizeof (elemAddr) / sizeof (short); 

		status = mdlScanCriteria_scan ( scP, elemAddr, &scanWords, &filePos); 
		numAddr = scanWords/sizeof (short); 
		for ( i = 0 ; i < numAddr; i++)
			{
			if (elemAddr [i] >= eofPos)
   				break; 
			if (elemAddr [i] < actualPos)
    				continue; 
			mdlElmdscr_read ( &cellDP, elemAddr [i], ACTIVE_FILE, FALSE, &actualPos); 
			if (cellDP->el.ehdr.type == CELL_HEADER_ELM)
				{
				mdlCell_extract ( NULL, NULL, NULL, NULL, cellname, MAX_CELLNAME_LENGTH, &cellDP->el);	
				if (cellname [0] == L'X' && cellname [1] == L'X')
					{
					replace = 0;
					status = mdlElmdscr_operation ( cellDP, (PFElemOperation )putTitleInfo, &dummy, ELMD_ELEMENT | ELMD_PRE_HDR | ELMD_PRE_NESTEDHDR);
					if (replace)
						status = mdlElmdscr_rewrite ( cellDP, NULL, actualPos);
					}
				}
			mdlElmdscr_freeAll (&cellDP);
			}
    		} while (status == BUFF_FULL); 
	return SUCCESS;

Modifying Design link URLs in Connect Edition using C# or VBA

$
0
0

I have a requirement from a customer to write a (once only throw-a-way) tool to run through a number of DGN files and update the base address in all of the link URLs. The links are a mixture of Engineering links (older V8i generated ones) and design links (newer connect edition generated ones). They are in the process of moving the linked file to a new SharePoint site (on-prem to O365)

Modifying V8i Engineering links look to be straight forward using VBA as they are implemented using TAGS. However the Connect Edition design links are a different story as it looks like they are stored using XAttributes from what I can tell.

I am seeking some advice and possibly sample code that I can adapt/include in a .NET (C#) command line program/tool to handle the newer form of links.

Viewing all 4331 articles
Browse latest View live


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