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

[V8i SS2 C# .Net]

$
0
0

I am trying to get an addin to work that launches and runs microstation in the background on windows server 2012 R2. The purpose of the addin is to convert DGN's to PDF's with appropriate levels and colors depending on the file path the DGN is in.

I am able to launch microstation succesfully, load my addin, send my addin command just fine (stepping through the code, debugging in visual studio by "attaching to" ustation.exe process), and I can't seem to figure out how to not get the below error. The error shows up and an exception is thrown on the lines:

I moved the file ecom.config (renamed from ecom.cfg) to the path the error describes and the error persists.

This process is currently running fine on a production server and converts PDF's with no issues.

app = Utilities.ComApp; (doesn't fail on this line)

 app.CadInputQueue.SendCommand("DIALOG PLOT"); (Error thrown on this line): Error images are attached. I 


I want to know, how to find minimum and maximum points of current View in Microstation VBA

$
0
0

Hi,

OS: Windows 7
Software : Microstaion v8 2004

I want to know, how to find minimum and maximum points of current View in Microstation VBA, below is the code which I have tried


Sub Bounding_box_view_min_max_pts()
    Dim view1 As View
    Dim ci As CursorInformation
    Set ci = CursorInformation
    Set view1 = ci.CurrentView


    Dim vw_extents_pt As Point3d
    Dim vw_origin_pt As Point3d
    Dim vw_center_pt As Point3d
    
    vw_extents_pt = view1.Extents
    vw_origin_pt = view1.Origin
    vw_center_pt = view1.Center
    
    Dim diagonal_pt As Point3d
    Dim distance1 As Double
    Dim angle1 As Double
    
    distance1 = Point3dDistance(vw_origin_pt, vw_center_pt)
    angle1 = Point3dAngleBetweenVectors(vw_origin_pt, vw_center_pt)
    diagonal_pt = Point3dAddAngleDistance(vw_center_pt, angle1, distance1, 0#)
    
    'vw_origin_pt and diagonal_pt are not matching minimum and maximum points of View
    ' how to find the minimum and maximum of current View
    
    
End Sub


Thanks & Regards,
(mmk)

How to maintain cell size equal while zoom in zoom out in microstation vba? Using Microstation2004 V8 in windows 7.

$
0
0

How to maintain cell size equal while zoom in zoom out in microstation vba? Using Microstation2004 V8 in windows 7.

Regards,

Uday

How to get View Min and Max points in Microstation Vba?

$
0
0

Hi,

How to get View Min and Max points in Microstation Vba?

Using Windows 7 and Microstation2004 V8.

[MS V8i c++] a question about function ---- mdlBspline_oneRailTwoSectionSweep(&surface, &loftPath, &startCurve, &endCurve, &dirVecStart, &dirVecEnd, fc_epsilon)

$
0
0

while  I used this function, I constructed the parameters "loftpath" by two ways. one is start a tool of ElementSetTool, as the code below:

bool BaseLine::OnModifyComplete(MstnButtonEventCP ev)
{

	MSElementDescrP	pathEdP;

	
	EditElemHandleP start = GetElemAgendaP()->GetFirstP();
	pathEdP = start->GetElemDescrP();

	if (NULL != pathEdP)
	{
		pathID = elementRef_getElemID(pathEdP->h.elementRef);
	}
	mdlElmdscr_freeAll(&pathEdP);

	//start another command
	mdlInput_sendKeyin("ROADWAY PLACECOMPLETE", 0, 0, NULL);


	ExitTool();
	return true;
}

in the code above, i get the ElementID of the path,  then , i construct MSElementDescr of the path by its ElementID;

void BaseLine::TransformBathLine(MSElementDescrP *pathEdPP, Transform *pTrans)
{
	if (NULL == pathEdPP)
		return;

	mdlAssoc_getElementDescr(pathEdPP, NULL, pathID, ACTIVEMODEL, false);

	if (NULL != pTrans)
		mdlElmdscr_transform(*pathEdPP, pTrans);
}

then, my program nearly stop at the function mdlBspline_oneRailTwoSectionSweep(thought it worked right, but too slowly to stand)

In another way, i construct path by the code below:

	MSElement el;
	DPoint3d pts[3] = { { 0.0, 100000000, 0.0 },{ 0.0, 0.0, 0.0 },{ 0.0, -1000000000, 0.0 } };
	mdlArc_createByCenter(&el, NULL, pts, 0, 0, 2);
	mdlElmdscr_new(&pathEdP, NULL, &el);

my program works well:

the differece between two methods is just how i get descriptor of path;(the path is the same form)

i do not know why? and  i would appreciate it if you are so kind to help me.

3D Text Extrusion through VBA

$
0
0

HI Team,

I need to Extrude Text Element,

I am trying following method but its not working

Dim oEleText As TextElement
BasePnt= Point3dFromXYZ(0, 0, 0)
Set oEleText = CreateTextElement1(Nothing, "Some Text", BasePnt, Matrix3dIdentity)
Dim ExtrusionText As SmartSolid
Set ExtrusionText = SmartSolid.ConvertToSmartSolidElement(oEle) ' Its not getting converted to Smart Element
Set ExtrusionText = SmartSolid.ExtrudeClosedPlanarCurve(oEle, 20, 0, True)

Thanks,

[CE U13 C#] XAttributeChangedEvent XAttribute.ID wrong value

$
0
0

With Update 13, the XAttributeChangedEvent now has the XAttribute Property but

eventArgs.XAttribute.ID
eventArgs.XAttribute.HandlerId

both give me the same value 0x17010000.
I've created the Element in V8i and used it for CE.



With V8i I can look at the xAttribute directly, like in the Screenshot but with CE this is not possible.


There is a workaround for this over native and there I get the right values I look for.

XAttributeHandle XAttrHandle = XAttributeHandle(p_ElemRefIn, h_XAttr, XAttributeHandle::MATCH_ANY_ID);
UInt32 un_XAttrId = XAttrHandle.GetId();


I do not know what happens with multiply xAttributes.


Switching from manged to native takes some time. Also we don't get the xAttribute completly from the Event and only can guess what xAttribute caused the Event. This workaround might work for most cases but most is not all.

Is there a better way or is that way good enoug until Bentley fixes it?

[V8i SS3 VBA] Create non-associative patterns

$
0
0

Hello,

I want to create non-associative patterns using VBA, I tried to use CreateHatchPattern1 method but it gave me only associative pattern.

So, It is possible to create an non-associative pattern with VBA ?


Saved view is not restored in 64 bit Connect Edition

$
0
0

Hi all,

I am quite new to Microstation. We have some Macros running well on 32 bit Microstation version 08.11.09.089. When we change to use 64 bit MicroStation Connect version 10.12.00.40, there are some issues, some of which have been fixed by adding PtrSafe and changing Long type to LongPrt in declare statements. But I am not able figure out how to fix the following issue.

Before running the Macro, the view is like attached image 1 (before process). After running the Macro, it shrinks and zoom way out as shown in image 2 (after process). Please note the view is supposed to be the same before and after process as it works that way in 32 bit MicroStation. The view change happens when calling the following sub. Specifically, it happens after executing this line: vw.ApplySavedViewElement SV, msdCopyViewPortApplySize. When I debug this Macro on both 32 bit and 64 bit MicroStation, I notice some values for SV properties are different between this two version. Other variables have same values. I am not sure if it's related to the issue and have no idea how to fix. Any help is greatly appreciated.

Sub RestoreView(strName As String, viewNumber As Long)
Dim vw As view
Dim SV As SavedViewElement

Set SV = ActiveDesignFile.FindSavedView(strName) ' Not using optional arguments

If Not SV Is Nothing Then
Set vw = ActiveDesignFile.Views(viewNumber)
vw.ApplySavedViewElement SV, msdCopyViewPortApplySize
End If
End Sub

C# Materials on levels in MicroStation v8i

$
0
0

Hi

We are doing the c# equivalent of: (Using dll imports)
Functionality developed in MicroStation v8i (08.11.09.357 )


//Code
mdlMaterial_initialize()
mdlMaterial_load(...)
MaterialProperties* material = mdlMaterial_create()

mdlMaterial_findByLevelName(material, app.ActiveDesignFile.MdlModelRefP(), level.Name, 0, NULL)
mdlMaterial_free(material)
mdlMaterial_cleanup()
//Snippet

and the mdlMaterial_findByLevelName returns 0 (ok) but the material pointer does not update.
I have even looked in the memory to see if the bytes change but they don’t…

How can I get the material Used by a level?
The mdlMaterial_findFromId does not seem to return anything either…

I can get the mdlMaterial_loadTable to work an find all the materials in the table but I need to get the materials used by level.

Any help is greatly appreciated

Regards Per Bodin - AEC AB

Create transient Element in Microstation 2004 v8

$
0
0

Hi,

I want to know, how to create transient Element in Microstation 2004 v8 using mvba, I cannot find it in help of ustn 2004 VBA (in windows 7 os)

can you suggest how to do it, if possible to use mdl functions in mvba 2004

Thanks & Regards,

(mmk)

Can I set the SaveAs Options in VBA? Ie Set the Remap CSV File

$
0
0

Hi,

Microstation CE Update 13, or OpenRoads Designer CONNECT Edition 2019 R2

I have a form and want the user to use a checkbox to determine which CSV remapping file will be used for linestyle remapping. I then want to set the SaveAs options through vba. 

Below is an image of the options that need to be set from vba -

I recorded this action but it is not working.

Implements IModalDialogEvents
Sub IModalDialogEvents_OnDialogClosed(ByVal DialogBoxName As String, ByVal DialogResult As MsdDialogBoxResult)

End Sub

Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult)

    If DialogBoxName = "Save As" Then'   The following statement opens modal dialog "Save As V8 Options"

        CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd " + oFilePath

        CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setFileNameCmd " + oNewFileName'   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  '

    If DialogBoxName = "Save As V8 Options" Then'   The following statement opens modal dialog "Select Remapping CSV File"'   Set a variable associated with a dialog box'   This only modifies a few bits of the variable it changes. It first'   creates a mask for clearing the bits it will change. Then it gets'   the variable and uses the mask to clear those bits. Finally'   it sets the desired bits in the value and saves the updated value.
        lngTemp = Not 1
        lngTemp = GetCExpressionValue("g_remapOptions.destV8.remapLineStyles", "REMAP") And lngTemp
        SetCExpressionValue "g_remapOptions.destV8.remapLineStyles", lngTemp Or 1, "REMAP"

        CadInputQueue.SendKeyin "LOCK FENCE INSIDE "'   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Save As V8 Options

    If DialogBoxName = "Select Remapping CSV File" Then
            CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd C:\ProgramData\Bentley\OpenRoads Designer CE\Configuration\WorkSpaces\TfNSW Design\Standards\Data\"

            CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setFileNameCmd " + oRemapFileName'   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Select Remapping CSV File

End Sub

I noticed this question has been raised several years ago with no real solution. Is it not possible?

Reference Attachments

$
0
0

How do I get Reference Clip information form Reference file attached in Master File in Microstation V8?

Pulling Cell Information Based on Color

$
0
0

Hi All,

So my company is currently trying to automate our Bill of Materials (BOM), as currently it is all done manually. so I have designed a code which pulls all cell names off of a DGN. File and places them into an access database for our BOM.

The problem comes in for when we have an old file and are just adding a few extra pieces to the drawing, because the current code will place all of the pieces into the BOM. Yet this is of course is bad because we only want to add the newly added pieces, to be ordered. The way this is handled in the manual method is we color the new to be ordered cells yellow, which works because when done manually this can be seen.

So my idea was to fix this would be to add a cell either "New Sheet" or "Refurbished" and run a form of "If" statement. So when the drawing is scanned by the code "If it sees New Sheet scan all cells, if it sees Refurbished Cell only scan yellow cells." But I am unsure how to scan only yellow cells, if someone could help me with a code of how to scan a cell based on color in VBA I would really appreciate it. Thanks.

Reference Origin & Master Origin

$
0
0

How to get the masterOrigin and referenceOrigin form Reference file attached in Master File in Microstation V8?


Save as DXF with level re-mapping

$
0
0

I am trying to save out a DXF similar to this post

https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/101832/v8i-c-mdlsystem_savedesignfileas

However I am using the Connect version and I keep getting a 'not a structure or union member' error after trying to set the value.  I did add the loading of DWGSETTINGS.ma but that didn't seem to help.  Here is the code

	WString s;
	CExprValue      value;
	value.type = CEXPR_TYPE_LONG;
	value.val.valLong = 1;

    mdlSystem_unloadMdlProgram(L"REMAP");
	mdlSystem_defineCfgVar(L"MS_REMAP_CSVFILE", myCSV, DgnPlatform::ConfigurationVariableLevel::User);
	mdlSystem_loadMdlProgram(L"DWGSETTINGS.MA", NULL, NULL);
	mdlSystem_loadMdlProgram(L"REMAP.MA", NULL, NULL);
	MdlDesc*      pMdlDescr = mdlSystem_findMdlDesc(L"REMAP");
	if (NULL == pMdlDescr)
	{
		mdlDialog_dmsgsPrint(L"REMAP application not loaded !");
		return ERROR;
	}

	if(SUCCESS !=mdlCExpression_setValueForApp(&value, NULL, "g_remapOptions.destDwg.remapLevels", VISIBILITY_CALCULATOR, pMdlDescr)) {
		mdlCExpression_generateMessage(s, mdlErrno); mdlOutput_error(s.c_str());
		}

DLL not unloaded, after MDL is closed (C++, v8i)

$
0
0

Hello,

I am just writing a short MDL for v8i (select series 4) in C++ that should mark all Elements in the file (by changing the line-weight), that fit to certain Database-criteria.

There is a Modal Dialog that allows to Switch on or off 4 different criteria, which are stored in a structure, which starts afterwards a Command-Function and has no Hook-functions, nor Hook-Item-functions.

The Command-function browses through all graphical Elements and calls a Callback-function, which does the Job of proofing the criteria in DB an changing the element-weight, if the criteria are fulfilled.

The MDL seems to work as it should do, except the fact, that (although the MDL is closed and no more visible in the active MDL-List) the DLL must be still running, because if I want to recompile some changes, I always get a message like this:

LINK : fatal error LNK1104: Datei "C:\PROGRA~2\Bentley\MICROS~1\MICROS~1\mdlapps\markelm.dll" kann nicht geöffnet werden.

Has anyone an idea for this reason and can give me a hint, what may cause this Problem?

Many thanks,

Ines Wieland

[V8i C++] MstnViewTool with element selection and RedrawElems

$
0
0

Hi,

I would like to implement a tool which after right click will return to a previous tool in use - like for example the Pan View tool. I found that it should inherit from the MstnViewTool . However my tool needs to do element selection and draw some shapes when I do manipulation (use RedrawElems).

How to make a MstnViewTool type tool with such abilities?

Alternatively, maybe there is a way to make a MstnElementSetTool  type tool which can return to a previous tool in use?

All the best

Wojciech

[Mstn CE VBA] Turn off Undo capabilities

$
0
0

Hi,

I have a VBA routine that deletes lots of elements (after copying\converting a file from dwg to dgn).  I am noticing that I am getting a lot of disk activity to the Users\AppDataLocal\Temp\Bentley\Microstation\10.0.0\Undo\xxx.tmp files.  I do not need to "undo" anything here.  Is there a way to disable the Undo feature, run my routine, and then re-enable Undo?

--Thanks,
--Robert

[CONNECT C++] Picklist class

$
0
0

The Picklist class inherits from RefCountedBase...

struct PickList : public RefCountedBase

Unlike other classes that inherit from RefCountedBase, Picklist looks like a normal C++ class: it has a public constructor and lacks a static Create() method that returns a smart pointer.  In other words, we can declare a Picklist on the stack...

Picklist pickList;
WString pickListName = pickList.GetName ();

Header file DgnPlatform.h applies a macro to the Picklist class to define a smart pointer type name...

DGNPLATFORM_REF_COUNTED_PTR (PickList)

The result of that macro is a typedef PicklistPtr.  However, since Picklist lacks a static Create() method we cannot create a PicklistPtr (unless we write a non-member function).  None of the Picklist examples uses PicklistPtr.  What have I missed?

Viewing all 4331 articles
Browse latest View live


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