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

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.


Unable to get the angle from cell element.

$
0
0

Hi All,

            I am using Microstation V8i (Select series 4) and c# language. i am trying to get the angle from cell element by using the following code but i didn't get the angle it's return always 0.0 only. Please anyone let me know what i did the mistake here.  I attached my testing dgn also please find it.

BCOM.Application app = BMI.Utilities.ComApp;
BCOM.ElementEnumerator eleEnum = app.ActiveModelReference.GetSelectedElements();
List<BCOM.Element> _lstEles = eleEnum.BuildArrayFromContents().ToList();
foreach (BCOM.Element ele in _lstEles)
{
    double _angle=0.0;
    if(ele.IsCellElement())
    {
        BCOM.Matrix3d cellrot = _ele.AsCellElement().Rotation;
        app.Matrix3dIsXYRotation(cellrot, ref _angle);
    }
}

Thanks & Regards,

Karthik Keyan.

communities.bentley.com/.../1030.Testing.dgn

[V8i VBA] Passing more than one KeyinArgument?

$
0
0

I found this discussion: https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/120244/v8i-vba-pass-command-arguments-to-macro which led me to the KeyinArguments property. But I'd like a little clarification or help with this.

I am looking into an MVBA that I can run through the batch process to replace a certain cell in a number of files. I'd like to pass OldCellName and NewCellName as KeyinArguments but I'm not sure I'm getting the syntax right, and I'm not sure how to pass "verbose" information

My command string for the batch process would look like

vba run RepCellVBA OldCellName NewCellName

From the Help file, it tells me I can use the Split function to break the argument "OldCellName NewCellName" into two separate strings. That will be fine if the cell names are a single word. But some of our cell names are phrases, instead of words (like "IN RW Left"). How does KeyinArguments handle phrases? Can I just use quote marks to delineate the different phrases:

vba run RepCellVBA "Old Cell Name" "New Cell Name"

and will KeyinArguments respect that those are two phrases (not six words)?

Of course, if someone has a macro that works already, or can point me to the keyin sequence to allow me to run replace cell through the batch process, it might save me the extra effort, and would be appreciated mightily!

Thank you for your assistance!
MaryB
MSTN 08.11.09.829

[CONNECT U12 C++] Determining the Tangent of a Point Projected to an Element

$
0
0

One can use CurverVector::ClosestPointBounded() to obtain a CurveLocationDetail that contains the location (CurveLocationDetail.point) of the "spacePoint" projected to the CurveVector. However, in order to obtain the Tangent at that location, one must use FractionToPoint or ComponentFractionToPoint (for LineStrings). In the case of a LineString, ComponentFractionToPoint() returns a DPoint3d "point" that is DIFFERENT from the DPoint3d returned in CurveLocationDetail.point. Why are they different?

recording a macro - parametric cell

$
0
0

Hello,

I tried recording a macro on changing a value of an assigned variable of a parametric cell and then promoted it into VBA, but I did not any results, any reason why or is it even possible for VBA to do this? Im using microstation CE 12

[CONNECT .NET] How to listen to the EnterIdleEvent with the CONNECT .NET API or P/Invoke?

$
0
0

I can't find any way of listening to the EnterIdleEvent with the CONNECT .NET API. I guess it was possible in V8i to P/Invoke  "mdlInput_setFunction (INPUT_ENTER_IDLE, OnEnterIdleState);" to get the same event, but it seems that this function is not exported in CONNECT anymore.

Is there any replacement?

Viewing all 7260 articles
Browse latest View live