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

[CONNECT C++] mdlText_create() gets the symbology wrong

$
0
0

Hi folks,

As the name suggests, it looks like this function is now bugged in V10 (update 9). Previously mdlText_create() would use the symbology of the template element passed as parameter #2. It seems in V10 the function now creates a text element with the active symbology instead.

Just a heads up in case you are porting old code, like I am. I don't suppose Bentley will fix this, since the function is deprecated.


How to open Microstation using C# - v8i

$
0
0

Hey guys,

Im a total noob starting to try to give my first steps in coding some application to automate some of the manual work we have in Mirostation v8i.

I am a coder myself, so feel free to go geeky with me.

I have cople of issues:

1. How to open microstation and load a file using C#?

2. How to save this new project in a microstation file format in C#

Note that this needs to be done from an expernal application.

And what DLLs we must reference?

[Connect C++] How to query the reference display priority

$
0
0

Here is the element display priority information copied from the help document: 

  • All elements in a reference with a higher Reference Display Priority will appear in front of all elements from references with a lower value.
  • Within a single model, or from references with the same reference display priority, elements on levels with higher Level Display Priority will appear in front of those with a lower value.
  • Where elements have the same reference and level display priority, then Element Display Priority determines those that will appear in front of others.
  • Where two elements have the same Reference, Level, and Element display priorities, then the one that appears later in the display order (that is, file position and update sequence) appears on top.

I would like to know what API can be used to query the "Reference Display Priority"? I searched and found this link https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/103181/v8i-vba-set-reference-priority/308338#308338 but seems it has no equivalent available APIs in C++ SDK.  

Error codes reference table?

$
0
0

Hi,

perhaps that's a silly question but... where is a reference table for error codes?

I.E: I'm using "mdlSolid_facetBody" and I get a 1043. What now?

Thanks

[CONNECT C++] DgnElementSetTool and Drag Selection

$
0
0

Is it somehow possible to differentiate how a selection is made inside DgnElementSetTool()? What I mean is that for PICKing an element, one can choose a single element, or a group of elements by dragging a box/line. What I'd like to be able to do is determine if the FIRST datapoint in a DgnElementSetTool is an attempt to locate an element, or is it the start of a "drag" select operation. My tool approach is that if a user simply gives a datapoint (no drag select) then iterate the entire model contents (with no accept point). If the user is creating a multi-select collection, then process only the elements in the selection (once the drag operation is complete, and then an accept point would also be required).

I can see three possibilities for the initial datapoint:

1. User has clicked, but NOT on an element.

2. User has PICKed a single element.

3. User is begiinng a drag selection operation.

Bruce

Help writing MVBA to drop status on cells in dgn

$
0
0

All,

I am using the below macro code to drop complex on cells in my dgn file.  After running nothing is changed except the color of the cell.  New to this object model and just hacking my way through.  Any direction is greatly appreciated.

regards,

Jon

Sub ScanExample()
    Dim scanCriteria As New ElementScanCriteria
    Dim i As Long
    'Dim myElement As TextElement

    Dim myStyle As TextStyle
    Dim myStyles As TextStyles
   
    ' Terminate any active commands
    CadInputQueue.SendCommand "NULL"
   
    '  Initially, the scan criteria is set up to handle all types.
    '  First, exclude all and then just include the ones we want
    scanCriteria.ExcludeAllTypes
  
    scanCriteria.IncludeType msdElementTypeCellHeader
 
    Set myStyles = ActiveModelReference.DesignFile.TextStyles
    Set myStyle = myStyles("NoFract")
       
    Dim enumerator As ElementEnumerator
    Set enumerator = ActiveModelReference.Scan(scanCriteria)
    ShowStatus "Reading elements"

    Do While enumerator.MoveNext
        With enumerator.Current
            .Redraw msdDrawingModeErase
            If enumerator.Current.IsCellElement = True Then
                Dim myElement As CellElement
                Set myElement = enumerator.Current
                ShowStatus "Cell = " & myElement.Name
               
                Select Case myElement.Name
                    Case Is = "VSYM"
                        Dim myComplex1 As ComplexElement
                        Set myComplex1 = enumerator.Current
                        myComplex1.Drop
                       
                        'enumerator.Current.AsComplexElement.Drop
                        'enumerator.Current.Redraw
                    Case Is = "PINST"
                        Dim myComplex2 As ComplexElement
                        Set myComplex2 = enumerator.Current
                        myComplex2.Drop
                       
                        'enumerator.Current.AsComplexElement.Drop
                        'enumerator.Current.Redraw
                End Select
      
            End If
                   
            .Color = (.Color + 1) Mod 10
            .Rewrite
            .Redraw msdDrawingModeNormal
        End With
       
        i = i + 1
        If (i Mod 50) = 0 Then
            ShowStatus "Updated element number " & i
        End If
    Loop
   
    ' Set MicroStation back to normal state
    CommandState.StartDefaultCommand
    ShowStatus "Updated element number " & i
End Sub

How to find verticality of a wall polygon in 3D model

$
0
0

Hi Team,

I need to find the vertical angle of the selected wall. I need to perform a check for marking the errors, if the wall angle in not vertical. Wall angle should be in the range if 88 to 92 degrees.

Thanks in advance.

Bangaruraju

Lập trình VBA MicroStation V8i

$
0
0

I have the object is the default Angle cell is 0 ° I want to rotate the object to the horizontal that coincides with the X axis of Microstaion V8i, 

My idea is to select objects using MicroStation V8i selection tool
This can be handled by VBA Microstation, hope everyone in the forum help me, thank you very much



[MicroStation CONNECT Update 7 MDL]: mdlElement_stroke consumes memory

$
0
0

mdlElement_stroke allocates memory for resulting points. Free() or delete() the pointer crashes
MicroStation complete. In older versions (up to V8i) it was possible (and necessary).
Is this a bug in mdlElement_stroke? Any correct way to free the pointer?

(C++ / VS2015)

Thomas

Expanding ProjectWise variable

$
0
0

Hi,

Does anyone in here know how to expand the ProjectWise configuration variable from a MCB?

If I use the function "activeworkspace.expandconfiguration" i get the local (translated) value. ex. c:\pwwork\<username>\<dmsfolder>

I would like to have the value pointing to ProjectWise. ex. pw.server.com\documents\<project>\<folder>

When I look in MicroStation workspace configuration, the value is exactly what I'm looking for, but it's not the value I receive in my VBA macro.

I want to retrive the master files folder path, and then set MS_MARKUPPATH relative to the masterfiles folder.

MDL bmake warning (SDK SS3 081109829) - c:....\toolsubs.dlo: trim previously defined. Ignoring new definition. Previous defined in....

$
0
0

Trying to make this warning go away. 'trim' is defined in my FDF file and called in a few functions. 

What do I need to do to clean this up?

Thanks!

[CONNECT C++] ToggleIcon Dialog Item

$
0
0

Is there a way to "press" a dialog ToggleIcon via code? My ToolSettings starts with a ToggleIcon in a "un-pressed" state. Once the user has made a choice (from a ComboBox item) I wish to "enable/press" the ToffleIcon via code to signal that the selection made was valid. I'm thinking it may have to do with the "value" of the ToggleIcon RawItemHdr? 

Bruce

[CONNECTR C++] Adding ItemTypes to New Element and SupportsCreateInstanceOnElement()

$
0
0

I'm using a SystemCallback::SetElmDscrToFileFunction() to capture when NEW elements are being added to a model. When a new element is added, I want to add an ItemType to that element. Once I confirm that the ItemTypeLibrary is valid and the ItemType exists, I create a CustomItemHost and perform GetDGnECInstanceEnabler(). This last part (GetDgnECInstanceEnabler()) is a recent addition to the code that now seems to be crashing. I'm wondering if it's not valid to do that given the element hasn't been written to the model yet....

ItemTypeP			pItemType = library->GetItemTypeByName(featureName.c_str());
if (pItemType != nullptr)
{
	// attach item type
	CustomItemHost itemHost(eeh, true);	// eeh NOT PERSISTENT so schedule attachment
	DgnECInstancePtr instance = itemHost.ApplyCustomItem(*pItemType);

	DgnECInstanceEnabler	enabler = instance->GetDgnECInstanceEnabler();
	wprintf(L"enabler=%08x\n", enabler);    // enabler is non-zero

	if (!enabler.SupportsCreateInstanceOnElement()) // <-- crashes here
		return;
	if (instance.IsValid())
	{
	...
	}
}

[CONNECT C++] Australian Spiral

$
0
0

The Update 9 SDK introduces an Australian Spiral (DSpiral2dAustralian) class.  What is an Australian Spiral?

[CONNECT C++] _OnPostLocate()

$
0
0

In OnPostLocate(), it is possible to display a message by the cursor by assigning a string to "cantAcceptReason". The instructions were to check if non-null and then assign your string. In CONNECT, that parameter changed to a WString. Is it still necessary to check for null? If so, how does one check? I see WString::IsNullOrEmpty(), but no "IsNull()".

Bruce


Get Element Angle Tool

$
0
0

Is there a tool which works in Microstation Connect which rotates elements to specific angles?

I had one for V8i but it won't load into Connect.

Copy from Ref Files to Specific Level of an Active File by VBA

$
0
0

I am using V8i. I have a master file with many references. I want to use VBA to copy all the contents in a reference to a specific level of the master file. The name of the specific level is same as the name of the reference.

This process I want to repeat to all of the references.

[CONNECT C++] DgnElementSetTool and User Picks

$
0
0

I'd like to set up my DgnElementSetTool such that any existing Fence or Selection Set prior to my tool installing will immediately call _OnElementModify() upon a datapoint. I'd also like to support the creation of a SelectionSet in my tool once loaded (if one did not exist prior to the tool loading). Lastly, I'd like to prevent the user from doing a "single pick" of an element and immediately firing _OnElementModify(). This is what I've got so far:

private: bool			_NeedAcceptPoint()							override { return false; }
private: UsesSelection	_AllowSelection()							override { return USES_SS_Check; }
private: UsesFence		_AllowFence()								override { return USES_FENCE_Check; }	// I *think* you need to have "fence use" turn ON as well
private: bool			_UseActiveFence()							override { return true; }	// If true, datapoint causes fence contents to be processed
private: UsesDragSelect	_AllowDragSelect()							override { return USES_DRAGSELECT_Box; }
private: bool			_WantDynamics()								override { return false; }	// needed for DragSelect to NOT continually call _OnElementModify()

which does most of what I want. The only thing it doesn't do is prevent a user from "single pick" and immediate execution of _OnElementModify(). I understand that when _NeedAcceptPoint() is false, that picked element will immediately cause _OnElementModify() to fire. How can I allow the creation of a SelectionSet and disallow the single "pick" of an element? I tried to use _OnDataButton() and call __Super::_OnDataButton() when there is a fence or selection set, and not call __super, but tell the user to click-drag for a SelectionSet. Unfortunately, the initial depress of the mouse button always causes the message box to appear:

private:	 virtual bool  _OnDataButton(DgnButtonEventCR ev) override
{
	SelectionSetManagerR		selection{ SelectionSetManager::GetManager() };
	FenceManagerR				fence{ FenceManager::GetManager() };

	if (fence.IsFenceActive() || selection.IsActive() )
	{
		__super::_OnDataButton(ev);
	}
	else
	{
		mdlDialog_openInfoBox(L"Please Create Selection Set by Click-Dragging the Cursor First");
	}
	return false;
}

MDL - how to delete a mesh face programmatically?

$
0
0

Given a mesh created with mdlMesh_newPolyfaceFromXYTriangulation, is it possible to delete faces of that triangulation through MDL? My criterion would be if the faces are above a certain size, if that helps. I don't see any relevant functions in the documentation.

[MSCE U9] Symbols not loaded for ustationDLL.pdb

$
0
0

While debugging the incrementText C++ example, I am able to set breakpoints and debug. However, when I cycle through and complete the breaks I get symbols not loaded for ustationDLL.pdb instead of focus back to the app.  After line 403 as shown, I get the Symbols not loaded. I somewhat remember this from before... but I do not recall any project setting that could be causing this issue. Any thoughts are appreciated. 

Best Regards

Viewing all 4331 articles
Browse latest View live


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