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

Microstation V8i using Native c++

$
0
0

Hi Friends,

I have used Microstation V8i select series 2 and visual studio 2005.

Project files are (.cpp, .r, .mke, .mki and .h)

Please find the below code and help me to simplify the code if possible

for (start_descr = tag_descr; tag_descr; )
    {
	    if(mdlTag_extract( NULL, NULL, &tag_spec, NULL, &tag_val, NULL, NULL, NULL, NULL, NULL, &tag_descr->el, ACTIVEMODEL ) == SUCCESS)
        {
	        if(mdlWideChar_strlen((MSWideCharCP)tag_spec.set.setName) == mdlWideChar_strlen((MSWideCharCP)SIP_TITEL_TAGSET))
            {
	            if(0 == mdlWideChar_strcmpi((MSWideCharCP)SIP_TITEL_TAGSET,(MSWideCharCP)tag_spec.set.setName))
                {
                    find = TRUE;
					//Revision level tag name
                    if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_REV))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisionlevel, tag_val.val.stringVal);
                    }
					//Revision level1
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_REV1))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisionlevel1, tag_val.val.stringVal);
                    }
					//Revision level2
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_REV2))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisionlevel2, tag_val.val.stringVal);
                    }
					//Date
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DATE))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisiondate, tag_val.val.stringVal);
                    }
					//Date1
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DATE1))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisiondate1, tag_val.val.stringVal);
                    }
					//Date2
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DATE2))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->revisiondate2, tag_val.val.stringVal);
                    }
					//Grund
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_GRUND))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->grund, tag_val.val.stringVal);
                    }
					//Grund1
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_GRUND1))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->grund1, tag_val.val.stringVal);
                    }
					//Grund2
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_GRUND2))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->grund2, tag_val.val.stringVal);
                    }
					//Herstkz
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_HERKZ))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->herstkz, tag_val.val.stringVal);
                    }
					//ZeichungsNr
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_ZEICHN))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->zeichnungsnr, tag_val.val.stringVal);
                    }
					//Plankennzeichen
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_PLAKEN))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->functionkennzeichen, tag_val.val.stringVal);
                    }
					//Ortskennzeichen
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_ORTSKEN))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->ortskennzeichen, tag_val.val.stringVal);
                    }
					//SheetNo
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_SHTNO))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->sheetno, tag_val.val.stringVal);
                    }
					//Schrank
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_POW))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->schrank, tag_val.val.stringVal);
                    }
					//Drawingid
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWID))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawingid, tag_val.val.stringVal);
                    }
					//DrawingHeader
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWHDR))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawingheader, tag_val.val.stringVal);
                    }
					//DrawingHeader1
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWHDR1))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawingheader1, tag_val.val.stringVal);
                    }
					//DrawingHeader2
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWHDR2))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawingheader2, tag_val.val.stringVal);
                    }
					//Titel
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_TITEL))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->titel, tag_val.val.stringVal);
                    }
					//Titel1
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_TITEL1))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->titel1, tag_val.val.stringVal);
                    }
					//Drawn By
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWNBY))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawnby, tag_val.val.stringVal);
                    }
					//Drawn Date
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_DRAWN_DATE))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->drawndate, tag_val.val.stringVal);
                    }
					//Checked By
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_CHECKEDBY))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->checkedby, tag_val.val.stringVal);
                    }
					//Checked Date
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_CHECKED_DATE))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->checkeddate, tag_val.val.stringVal);
                    }
					//Approved By
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_APPROVEDBY))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->approvedby, tag_val.val.stringVal);
                    }
					//Approved Date
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_APPROVED_DATE))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->approveddate, tag_val.val.stringVal);
                    }
					//Sig Art
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_SIGART))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->sigart, tag_val.val.stringVal);
                    }
					//FunctionNr
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_FUNCTION_NR))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->function_nr, tag_val.val.stringVal);
                    }
					//Function Drawing
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_FUNCTION_DWG))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->function_dwg, tag_val.val.stringVal);
                    }
					//Function Sheet
                    else if(0 == mdlWideChar_strcmpi((MSWideCharCP)tag_spec.tagName,(MSWideCharCP)TAG_FUNCTION_SHT))
                    {
                        if( (check_char_drg(tag_val.val.stringVal)) != 0 )
                            strcpy(tab->function_sht, tag_val.val.stringVal);
                    }
                }
            }
            if(tag_val.type == MS_TAGTYPE_CHAR)
                free(tag_val.val.stringVal);
        }
        tag_descr = tag_descr->h.next;
    }//for

Regards,

Saravanan


[CONNECT U7 C++] How to work with a file not yet assigned to workspace/workset?

$
0
0

Hi,

in MicroStation CONNECT Edition, when a user opens a file not yet assigned to workspace/workset, he is asked whether MicroStation should use the current workspace/workset (and to assign the file to it) or the file should remain unassigned.

How this process can be tracked and managed in C++ API? I have not tested it in code, but if I understand it right, LoadDgnFile method should be used to open a file existing on disc. What is the right way how to track workspace/workset detection and possibly to assign the file to chosen one?

With regards,

  Jan

[CONNECT C++] User Commands not being executed when clicking on menu items

$
0
0

Hi guys,

In my application's main dialog I have a menubar with one pulldown menu item.

Here is the menu resource definition:

DItem_PulldownMenuRsc PULLDOWNMENUID_DialogDemo1 =
{
    NOHELP, OHELPTASKIDCMD, HOOKMENUID_tables,
    ON | ALIGN_LEFT,"~File",
    {
        {"~Load Settings...", NOACCEL, ON, NOMARK,
                0, NOSUBMENU, NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, CMD_FILE_LOAD_SETTINGS, LCMD, ""},
        {"~Save Settings...", NOACCEL, ON, NOMARK,
                0, NOSUBMENU, NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, CMD_FILE_SAVE_SETTINGS, LCMD, ""},
        {"-", NOACCEL, ON, NOMARK,
                0, NOSUBMENU, NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, NOCMD, LCMD, ""},
        {"~Export to CS.OUT...", NOACCEL, ON, NOMARK,
                0, NOSUBMENU, NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, CMD_TABLES_SAVE_CS_OUT, LCMD, ""},
        {"-",   NOACCEL, OFF, NOMARK, 0, NOSUBMENU, NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, NOCMD, LCMD,""},
        {"E~xit",  NOACCEL, ON,  NOMARK, 0, NOSUBMENU,
                NOHELP, OHELPTASKIDCMD,
                NOHOOK, NOID, CMD_DMSG_ACTION_SYSMENUCLOSE, MTASKID, ""},    
    }
};

All of the menu items point to commands of the form CMD_... which are defined in the application command table as follows:

MdlCommandNumber commandNumbers[] =
{
    { (CmdHandler)loadSettings, CMD_FILE_LOAD_SETTINGS },
    { (CmdHandler)createTablesCommand, CMD_CREATE_TABLES },
    { (CmdHandler)setButtonStateAgain, CMD_SET_BUTTON_STATE },
    { (CmdHandler)exportToCSOUT, CMD_TABLES_SAVE_CS_OUT },

    { (CmdHandler)scanGradeTextClearAll, CMD_GRADE_SCAN_CLEAR_ALL },
    { (CmdHandler)scanGradeTextSelectAll, CMD_GRADE_SCAN_SELECT_ALL },
    { (CmdHandler)scanSubTextClearAll, CMD_SUBASE_SCAN_CLEAR_ALL },
    { (CmdHandler)scanTextSelectAll, CMD_SUBASE_SCAN_SELECT_ALL },
    { (CmdHandler)scanGradeXSForListboxText, CMD_SCAN_GRADE_XS },
    { (CmdHandler)scanSubXSForListboxText, CMD_SCAN_SUB_XS },
    { (CmdHandler)selectGradePVMText, CMD_SELECT_GRADE_PVM_TEXT },
    { (CmdHandler)selectSubPVMText, CMD_SELECT_SUB_PVM_TEXT },

    { (CmdHandler)loadGradeNameList, CMD_TABLES_OPEN_GRADE_LIST },
    { (CmdHandler)saveGradeNameList, CMD_TABLES_SAVE_GRADE_LIST },
    { (CmdHandler)loadSubNameList, CMD_TABLES_OPEN_SUB_LIST },
    { (CmdHandler)saveSubNameList, CMD_TABLES_SAVE_SUB_LIST },

    { (CmdHandler)openMainDialog, CMD_MAINTABLES },
    { (CmdHandler)openSubaseSettings, CMD_SELECT_SUBASE_SETTINGS },
    { (CmdHandler)openGroundSettings, CMD_SELECT_GROUND_SETTINGS },
    { (CmdHandler)openGradeSettings, CMD_SELECT_GRADE_SETTINGS },
    { (CmdHandler)openTableScaleSettings, CMD_SELECT_TABLE_SCALE },
    { (CmdHandler)openErrorSettings, CMD_SELECT_ERROR_SETTINGS },
    { (CmdHandler)openXSSettings, CMD_SELECT_XS_SETTINGS },

    { (CmdHandler)openCenterlineSettings, CMD_SELECT_CENTER_SETTINGS },
    { (CmdHandler)openProcessSettings, CMD_SELECT_PROCESS_SETTINGS },
    { (CmdHandler)openLimitsSettings, CMD_SELECT_LIMITS_SETTINGS },
    { (CmdHandler)saveSettings, CMD_FILE_SAVE_SETTINGS },
    { (CmdHandler)openTextSettings, CMD_TEXT_SETTINGS },
    { (CmdHandler)openGradeScanSettings, CMD_GRADE_SCAN_SETTINGS },
    { (CmdHandler)openTitleSettings, CMD_SELECT_TITLE_SETTINGS },
    0
};

For some reason non of the commands get executed when I click the menu items.

Only the EXIT command CMD_DMSG_ACTION_SYSMENUCLOSE gets executed.

I don't understand what is wrong with my menu resource definition.

Regards,

Benzi

[V8i C# Addin] Manipulate the Tasks Panel

$
0
0

Hello again,

I am using V8i Select Series 4, C# addin development.

Is it possible to add/remove/update tasks in the task bar from the addin? I added the below "Custom Toolbar" toolbar/task manually and would like to manipulate it from the addin.

Also a possibly related but could probably use its own post question: can we add/remove/update configuration variables from the C# addin API? I found a lot of results on the forum regarding configuration variables but none covering C# support.

Here's a picture for reasons.

Thank you for your time.

[CONNECT C++] LevelHandle

$
0
0

I'm attempting to iterate thru a EditElementHandle. I wish to dump out the level name of each element in a cell. The iteration immediately crashes when I attempt to get FileLevelCache:

	void				DumpCellLevelNames(EditElementHandleR eeh)
	{
		FileLevelCache* fileLevelCache = eeh.GetElementRef()->GetDgnModelP()->GetFileLevelCacheP();
        // Crashes ^^^^^^^^^^^^^^^^^
		wprintf(L"type=%d\n",eeh.GetElementType());     // sanity check 
		for (ChildEditElemIter child(eeh); child.IsValid(); child = child.ToNext())
		{
			DumpCellLevelNames(child);
		}
	}

I read a cell from the library with mdlCell_getElmDscr(), and create the EditElementHandle and call the iteration function like this:

m_eeh.SetElementDescr(edP, true, false);
DumpCellLevelNames(m_eeh);

Bruce

[CONNECT C++] Delete Item Type Report Node

$
0
0

My Item Type defines a ReportCategoryNode that contains ReportDefinitionNodes.  While I can see how to add a new report node or find an existing node, I don't see how to delete an existing report node.  Any suggestions, or have I missed something?

VBA syntax is to use mdl functions

$
0
0

The MDL documentation defines the VBA declarations for..

Declare Function mdlModelRef_setModelDefaultRefLogical Lib "stdmdlbltin.dll" (ByVal modelRef As Long, ByVal pDescr As Long) As Long
Declare Function mdlModelRef_getModelDefaultRefLogical Lib "stdmdlbltin.dll" (ByVal modelRef As Long, ByVal pDefaultRefLogical As Long) As Long

I can't figure out what the correct VBA syntax is to use these mdl functions. Does anyone have an example?

Kind Regards Gavin

[CONNECT C++] Report Filter

$
0
0

SDK example ReportsExample shows how to define an Item TypeReport programmatically.

There is a commented line that illustrates a filter, to restrict the rows generated in the Report...

reportNode->SetRowFilter (L"this.DgnCustomItemTypes_VendorCatalogItem::VendorItem::OutofStock=False");

How does one write the quoted filter coloured blue above?  It's enigmatic in so many ways.

  • What is this?
  • DgnCustomItemTypes_VendorCatalogItem is the internal name of an Item Type?
  • VendorItem is a property of the Item Type?
  • Is that filter grammar described anywhere?


[CONNECT C++] mdlElmdscr_partialDelete() and obtaining an ElementId

$
0
0

Is there a way to obtain the ElementId of the results of calling mdlElmdscr_partialDelete()? That function returns possibly two MSElementDescr's representing the results of the partial delete. After testing to ensure they are not NULL, calling mdlElmdscr_add(), adds it to the model. That call ( mdlElmdscr_add() ) returns the FilePosition where the element was added. I'd like to somehow obtain an ElementId for that element so I can create and append a Dependency Linkage.

Bruce

AECOsim Microstation V8i VBA Userform Combo box Rowresource

$
0
0

Is it possible to pull a vba combobox Rowsource list from excel for a userform that is in AECOsim Microstation V8i VBA?

I have an Excel Sheet that contains Lists for shapes that are in our steel library, and would like to use these lists to create multiple Combo boxes.  I've seen how combo box lists can be pulled from one workbook to another, but not a way to go from a workbook to Microstation VBA.

Thank you in advance for your time and energy.

[V8i SS3 VBA] Loop through selected elements

$
0
0

Hi!

I have a layout with a bunch of elements that are grouped together.
I need to loop through all of them and every elements in the grouped elements needs to be read as well.
But at the end they need to be regroup again.

This is few options I found:
Select the grouped cell, ungroup it, add to a NamedGroup, and then loop through the elements in the NamedGroup.
Unfortunately it doesn't work. The code is attached underneath.

Any suggestions?

Thanks!

Regards,

Cindy

Sub zelle_coord_auslesen(excel_wb As Workbook)

On Error GoTo ErrorHandler

'0. Microstation Vorbereiten'Zelle/Elemente in der Ebene
Dim anzahl_element As Integer, oCell As CellElement, oCell_in_group As CellElement, oText As TextElement
Dim oScan As ElementScanCriteria, ee As ElementEnumerator
Dim group As NamedGroupElement, ee_group As ElementEnumerator, anzahl_element_group As Integer'Element Eigenschaften
Dim title As String, value As String, teilenummer As String, teilebez As String, inhalt As String
Dim einbaurate As String, pickernummer As String, umfangbez As String, routenfahrer As String

Dim row As Integer, row_start As Integer
Dim col As Integer

anzahl_element = 0
row_start = 3


'0.1 Scan current design file
Set oScan = New ElementScanCriteria
Set ee = ActiveModelReference.Scan(oScan)

With excel_wb
Do While ee.MoveNext
    If ee.Current.Type = msdElementTypeCellHeader Then 'CreateCellElement1 is Type: Cell Header
        anzahl_element = anzahl_element + 1
        Set oCell = ee.Current.AsCellElement
        row = row_start + anzahl_element'write the pflicht data in Excel File
        .Sheets(1).Cells(row, 1).value = oCell.name
        .Sheets(1).Cells(row, 2).value = oCell.Range.Low.X
        .Sheets(1).Cells(row, 3).value = oCell.Range.Low.Y
        .Sheets(1).Cells(row, 4).value = oCell.Range.Low.Z
        .Sheets(1).Cells(row, 5).value = oCell.Range.High.X
        .Sheets(1).Cells(row, 6).value = oCell.Range.High.Y
        .Sheets(1).Cells(row, 7).value = oCell.Range.High.Z'if Cell doesn't have name, then it's a group cell with trailer
        If oCell.name = "" Then
            ActiveModelReference.SelectElement oCell'Ungroup selected element
            CadInputQueue.SendCommand "UNGROUP SELECTION"
            CommandState.StartDefaultCommand'in Group as member
            Set group = AddVBATempGroup
            group.AddMember oCell
            group.Rewrite'read the elements in the group
            anzahl_element_group = 0
            Set ee_group = group.GetElements(False)
            Do While ee_group.MoveNext
                anzahl_element_group = anzahl_element_group + 1
                If ee_group.Current.Type = msdElementTypeCellHeader Then
                    Set oCell_in_group = ee_group.Current.AsCellElement
                    If anzahl_element_group = 1 Then 'Trailer
                        .Sheets(1).Cells(row, 14).value = oCell_in_group.name
                        .Sheets(1).Cells(row, 15).value = (oCell_in_group.Range.High.X - oCell_in_group.Range.Low.X) * 1000
                        .Sheets(1).Cells(row, 16).value = (oCell_in_group.Range.High.Y - oCell_in_group.Range.Low.Y) * 1000
                        .Sheets(1).Cells(row, 17).value = (oCell_in_group.Range.High.Z - oCell_in_group.Range.Low.Z) * 1000
                    Else 'Behälter
                        .Sheets(1).Cells(row, 11).value = oCell_in_group.name
                        .Sheets(1).Cells(row, 12).value = (oCell_in_group.Range.High.X - oCell_in_group.Range.Low.X) * 1000
                        .Sheets(1).Cells(row, 13).value = (oCell_in_group.Range.High.Y - oCell_in_group.Range.Low.Y) * 1000
                    End If
                ElseIf ee_group.Current.Type = msdElementTypeText Then
                    .Sheets(1).Cells(row, 9).value = oText.Text
                End If
            Loop
        End If'Group selected element
        CadInputQueue.SendCommand "GROUP SELECTION"
        CommandState.StartDefaultCommand'unselect all
        ActiveModelReference.UnselectAllElements
    End If
Loop
End With

ErrorHandler:
    Select Case Err.Number 'Evaluate error number
        Case 55 'Error: File already opened
            Close #1
            Resume 'Resume execution at same line that caused the error
        Case Else
            MsgBox "ErrorNr: " & Err.Number & " Msg: " & Err.Description
    End Select'   Resume 'activate this for testing

End Sub

[CONNECT C++]The 2D sheet model references a 3D design model issue

$
0
0

Dear experts,

If a 2D sheet model references a 3D design model, I assume that the 3D model will be attached in the 2D sheet by the saved view or the certain standard view. 

My question: for the 3d design model, can I get the 2D projected curves by the saved view or the standard view?

[CONNECT C++] Item Types Report Sort Order and Priority

$
0
0

Item TypeReports seem to have two qualifiers for sorting: order and priority.

When we design a Report interactively we can set the sort order to be ascending or descending...

Report Definition Dialog

Note that the dialog does not refer to priority.

A SortingGroupNode class is qualfied with a SortingRule (WCharCP columnName, int priority).  It makes no mention of sort order.

How are the user's sort order and the programmer's sort priority related?

[CONNECT C++,C#] Difference between ScanCriteria.SetDrawnElements() and SetModelSections()?

$
0
0

Hi,

both in native and managed API there are two methods available (using C# notation):

  • ScanCriteria.SetDrawnElements()
  • ScanCriteria.SetModelSections(DgnModelSections section)

My question is:

ScanCriteria.SetDrawnElements() equal or not to ScanCriteria.SetModelSections(DgnModelSections.GraphicElements)

I understand SetModelSections allows finer filtering, but is SetDrawnElements() the same as GraphicElements section or it's a combination of more sections?

With regards,

  Jan

[CONNECT VBA] Inconsistent elements count results: VBA/Interop bug?

$
0
0

Hi,

I spent last few days playing with different ways how to scan elements in NET (old Interop, using ModelElementsCollection and using ScanCriteria).

When I compared speed using simple counting elements with no other criteria than "just graphic elements", I discovered weird results how many graphic elements is in the file:

VersionMethodResultNote
V8i (SELECTseries 4)Ctrl+A1 046 450
V8i (SELECTseries 4)VBA1 046 092why?
CONNECT Edition Update 8Ctrl+A1 046 450
CONNECT Edition Update 8VBA1 032 653why?
CONNECT Edition Update 8InteropDGN1 032 653why?
CONNECT Edition Update 8ModelElementsCollection1 046 450
CONNECT Edition Update 8ScanCriteria1 046 450

To count elements in VBA, I use this code:

Dim esc As New ElementScanCriteria
esc.ExcludeNonGraphical

Dim ee As ElementEnumerator
Set ee = ActiveModelReference.Scan(esc)

Dim numberOfElements As Long
numberOfElements = 0

Do While ee.MoveNext
    numberOfElements = numberOfElements + 1
Loop

My original assumption was that every API, when the same conditions are set, wil return the same number, which should be equal to "select all" command. The new NET API does it, but both VBA and InteropDGN methods return smaller number.

I experience this issue in one specific design file only (but I have not tested tens and tens for files). Maybe the file is corrupted (it's huge 2D and quite old), but even if corrupted, I don't understand difference between "user key-in" (Ctrl+A) and iteration using VBA or Interop. Maybe it's bug in VBA API? Because results from new NET API are the same as "select all", I guess this API works fine.

If somebody from Bentley is interested in further evaluation, I am able to share the file (size 32 MB). But it's my customer's data, so I am allowed to share it for testing purposes only and only with Bentley stuff.

With regards,

  Jan


[CONNECT C++] DialogItemHookHandler

$
0
0

When writing a class based on DialogItemHookHandler. in _OnButton(), how does one retrieve the ID of the button. I used to do this:

if ( dimP->dialogItemP->id == PUSHBUTTONID_Note )
....

Bruce

[CONNECT C++] Item Types -- Report Definition fails

$
0
0

My code for AreaAnnotator creates an Item Type definition in the active DGN file if one doesn't already exist. That works fine, and I can add Item data to shape elements.

The code also attempts to define a Report, and I am failing miserably.  Here's a screenshot of a Report definition created programmatically.  The Item Types library is named AreaAnnotator_1_0.  Following the example delivered with the SDK, the code uses the Item Type internal name DgnCustomItemTypes_AreaAnnotator_1_0. The Item Type is named Area Feature.

Item Type Report created programmatically

Note the Summary bottom-right, where the Find All line is highlighted red to denote that the criterion is invalid.

If I attempt to edit the Included Items, the first thing that happens is a modal dialog which tells me the columns are invalid because the Item Type properties do not exist...

Report definition -- invalid columns

If I OK to continue (which deletes the columns) and then select manually my Item Type (which is Area Feature) I end up with this definition...

Report - Editing Manually

Now the Included Items shows Area Feature— but without the Item Type library name.  The Summary shows Area Feature in black, indicating that it's valid.  I can add columns corresponding to the properties of Area Feature, and the report works.

Why is my programmatic report not working?  What is the significance of the evidence that the Report works when Included Items shows only the Item Type name and but not when the name is qualified with the internal library name?

[CONNECT C++] Item Type Report -- DgnECHostRelationshipSpecification

$
0
0

My report successfully harvests information about my Item Type instance properties. Now I want to add related DGN element properties.

My Item Type information is specified using DgnECHostSpecification.SetPrimaryClasses. Now I want to use DgnECHostSpecification.SetRelationships to add DGN element properties to the report. That method takes a DgnECHostRelationshipSpecificationList, which is a vector of DgnECHostRelationshipSpecification.

The constructor of DgnECHostRelationshipSpecification requires two ECN::SchemaNameClassNamePairs: relationship and related.

I don't know what is required for ECN::SchemaNameClassNamePairs relationship and related. Any suggestions?

[CONNECT C++] Relationship Manager

$
0
0

I just noticed the Relationship Manager in the MicroStationAPI documentation.  Is that a C++ development of the Dependency Manager, or something else?

[Connected C++] How to get the "ViewPort" of a DgnAttachmentP?

$
0
0

Hi Experts,

In connection application, one can attach a 3d design to a 2d drawing model. If doing that, the elements from the 3d design looks like a planar copy.

I guess there is a ViewPort set to the DgnAttachmentP of the 3d design attachment.

Do you know how can I get the ViewPort of the DgnAttachmentP?

I ask this because I want to get a 2d copy of the 3d design by  ElementCopyContext with setting a ViewPort by API SetViewPort().

Could someone help me on this?

Thank you,

Ping

Viewing all 7260 articles
Browse latest View live