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

Metadata

$
0
0

This may be the wrong group but I figured you guys would know the answer.

My office is involved in some litigation over an old project.

The Lawyers are asking us to give them the "metadata" for the project in question...

Is it even possible to export metadata from dgn files or has someone been watching to much CSI??

Thanks,


[V8i C++] Copy Text Style into TCB

$
0
0

In V8i, I use the following code snip to "copy" a Text Style into the "none" style, and then text placed has the settings from my text style, but does not have a linkage back to the style (Element Properties shows Text Style: none), so when I change the style later, the text does not change.

MdlTextStyle		*pStyleTemplate = mdlTextStyle_create();
UInt32			styleId;
if ( SUCCESS == mdlTextStyle_getByName(&pStyleTemplate, &styleId, L"MyStyle", ACTIVEMODEL, true) )
{
	...
	mdlTextStyle_copyTextStyleIntoTCB(pStyleTemplate,0);
}
mdlTextStyle_free(pStyleTemplate);

 

 

Is there a MicroStation API equivalent for mdlTextStyle_copyTextStyleIntoTCB() ? I can perform all my text settings using TextStyleManager and DgnTextStylePtr, but I can only "Activate" the tweaked style. Text placed is tied back to that "altered" Text Style" and is affected by future changes to the style.

 

Bruce

[CONNECT C++] Copy Item Type Library to a DGN file

$
0
0

I want to copy an Item Type Library (ItemTypeLibrary class) from a DgnLib into the active DGN file.

Having found the Item Type Library in a DgnLib, I think I want to use ItemTypeLibrary.CloneForFile (activeDgnFile, forReplacement).  What does the second argument do?

[V8i VBA] Vector3dPolarAngle Method - Result inverse of expected, why?

$
0
0

Simple test case above, I have a vector and I am using Vector3dPolarAngle to access the existing rotation of the vector. My understanding is the angle returned is calculated counter-clockwise from the x-axis yet the value provided as viewed in locals window/debug.print is measured clockwise from the x-axis. Is this a bug or an accepted feature of this particular method?

Dim UnitNormal                            As Vector3d
UnitNormal = Vector3dNormalize(Vector3dSubtractPoint3dPoint3d(SourceCoordinate, ProjectedPoint))
Dim AngleRadians As Double
AngleRadians = Vector3dPolarAngle(UnitNormal)

[CONNECT DItem_PushButtonXRsc] Trying to launch CONNECT "Place Note" tool

$
0
0

In one of my V8i tools, I display a DialogBox that has a PushButtonXRsc item. That item is defined like this:

DItem_PushButtonXRsc PUSHBUTTONID_Note=
{
	NOT_DEFAULT_BUTTON, NOHELP, MHELP,
	HOOKITEMID_CheckForLevel, NOARG, 67043840 /*CMD_NOTE*/, MCMD, Icon, ICONID_PlaceNote, "", "Place\nNote"
}
    extendedAttributes
    {{
    {EXTATTR_FLYTEXT, "Place Note With Leader"},
    {EXTATTR_BALLOON, "Place Note With Leader"},
    }};

 

When the button was pressed, it executed MicroStation's CMD_NOTE (67043840). The number as derived from looking at "customize", "drawing" task. Click on it to see the embedded command number used.

 

Now when I do the same for CONNECT, I see:


however, when I put that into my PushButtonXRsc item, and launch my DialogBox, pressing the button does NOT LAUNCH the Place Note tool/command.

DItem_PushButtonXRsc PUSHBUTTONID_Note=
{
	NOT_DEFAULT_BUTTON, NOHELP, MHELP,
	HOOKITEMID_CheckForLevel, NOARG, 16973824, MCMD, Icon, ICONID_PlaceNote, "", "Place\nNote"
}
    extendedAttributes
    {{
    {EXTATTR_FLYTEXT, "Place Note With Leader"},
    {EXTATTR_BALLOON, "Place Note With Leader"},
    }};

 

 

What is the correct way to get the command to execute?

 

Bruce

[CONNECT C++] Getting a DgnTextStylePtr for StyleID=0

$
0
0

How does one get/set the "Style (none)" (i.e. StyleId 0 ) text style ?

 

I've tried:

DgnTextStylePtr			noneStylePtr=DgnTextStyle::GetByID( 0, *ISessionMgr::GetMasterDgnFile() );

 

 

but that returns both!IsValid() and IsNull(). I also tried to take an existing TextStyle, change a few settings, and then use SetID(0) followed by SetActive() to try and force the settings of my TextStyle to be loaded into the "Style (none)" style and activated such that when text is placed, it is set with Style=Style (none).

 

Bruce

2-6957

[V8i C#] Enumerating sub elements of SmartSolid returns wrong elements

$
0
0

Hi everyone I'm having some trouble reading the sub elements of a SmartSolid Element. The code below is based on the answer given in this thread:

https://communities.bentley.com/products/programming/microstation_programming/f/53220/p/127746/389036#389036

But the problem I'm seeing does not appear to surface for the asker of that question.

For Example: in the code the 'element' variable is the blue highlighted solid in the picture below. I would expect to encounter 4 arcs and two circles in the enumeration, however the enumeration returns eight arcs, all with a zero ID value, and one DgnStoreComponent.

Does anyone know what I might be doing wrong?

ElementEnumerator solids = m_App.SmartSolid.ConvertToSmartSolidElement(element)

while (solids.MoveNext())
{
    SmartSolidElement solid = solids.Current.AsSmartSolidElement;

    var subElements = solid.GetSubElements();

    List<Element> elements = new List<Element>();//this ends up filled with arcs with ID 0

    while (subElements.MoveNext())
    {
        Element subPart = subElements.Current;
         elements.Add(subPart);
    }
}

[CE C++] Is it possible to create own in-memory only (virtual) DgnModel?

$
0
0

Hi,

I am working on a feasibility study, where the main target is to visualize data in MicroStation. The data are accessible through custom API and because the dataset is huge, API is quite slow and data can change from time to time, to convert the data into DGN file upfront and open it afterwards seems to be not good enough solution.

I'd like to ask whether it's possible to create something like own in-memory DgnModel (or similar element cache) not representing DGN file, but own format or even no format (e.g configuration data only), and to add it to list of MicroStation displayed models (e.g. as own attachment)? I have not studied current CE Update 4 API in detail yet, but I don't recall such method now.

The target functionality is similar to how Accu3D data are displayed now: The file is not DGN, can be accessed through http and not localy and the data are displayed accordingly to zoom level.

I think alternative way is to hook a view update event and to draw data to a view using own code, but right now my feeling is that it's not the best way how to do it.

With regards,

  Jan


ECSchema Editor 1.0 for viewing only now?

$
0
0

Hi all,

I found found out that ECSchema Editor version 1.0 is available for download from Fulfillment Center.

It seems to be completely rewritten and redesigned successor of Bentley Class Editor, but after quick test, I did not find any way how to create anything or edit opened schema. Because there is no readme or announcement, I'd like to ask if it's the feature of the first version and it's focused to testing basic stability, GUI etc. or whether I missed some setting or function.

With regards,

  Jan

[CONNECT C++] Text Styles: Misleading Documentation and irrelevant files and classes

$
0
0

In its entirety, MstnTextStyle.h...

/*--------------------------------------------------------------------------------------+
|
|   Supplied under applicable software license agreement.
|
|   Copyright (c) 2017 Bentley Systems, Incorporated. All rights reserved.
|
+---------------------------------------------------------------------------------------*/
#pragma once
#pragma once

#include <DgnPlatform\DgnTextStyle.h>
#include <DgnPlatform\TextBlock/TextAPICommon.h>

BEGIN_BENTLEY_MSTNPLATFORM_NAMESPACE



END_BENTLEY_MSTNPLATFORM_NAMESPACE

When searching MicroStationAPI help for information about Text Styles, there is a lot of noise in the result.  The most useful class is DgnTextStyle, which appears to supersede the mdlTextStyle_api (but which is still present). A search for Text Style also seems to indicate that there is a MstnTextStyle class and includes the above header. 

Search results also include the TextStyle Struct Reference, which provides this enigmatic note: This structure is not intended to be used directly, and supports file storage.  Contains the property data of a text style. Use DgnTextStyle instead.

But DgnTextStyle does not inherit from TextStyle, so what's the point of the latter?

[CONNECT C++] SessionMgr: difference between Active DGN File and Master DGN File

$
0
0

ISessionMgr provides several pairs of methods that operate on a MasterDesignFile and ActiveDesignFile.  What's the difference between Master and Active?

How to use codes to open the AcccuDraw

$
0
0

I inherited the class of DgnPrimitiveTool ,  my aim is to use this tool class to draw a line,

in the mouse click event - _OnDataButton , write the codes.

first:  how to open the AccuDraw use codes , when I draw the line , both  before and  after I click the mouse ,I need the AccuDraw to take effect  .   

second: how to use the  AccuDraw to set direction , example lock x axis.

supplements: we can open the AccuDraw by shortcut F11 and O

[CONNECT C++] Changing text font

$
0
0

Trying to change the font of a text element from Arial to Century Gothic, and using a code snip from the U5 help file:

 

	virtual StatusInt ChangeFontTool::_OnElementModify(EditElementHandleR eeh) override
	{
		// read the text string

		// aquire the font object
		DgnFontCP newFont = DgnFontManager::FindSystemFont(L"Century Gothic"); // Optionally provide a filter to find only RSC, SHX, or TrueType fonts; must also check NULL.
		if ( newFont->IsValid() && newFont != nullptr )
		{
			wprintf(L"Font found\n");
			// Create the helper class...
			ElementPropertiesSetterPtr remapper = ElementPropertiesSetter::Create();
			remapper->SetFont(*newFont); // Dereference newFont if required based on how you got and verified the font object.

			// Change the font...
			bool	bStatus = remapper->Apply(eeh);

			// You may now AddToModel or ReplaceInModel on eeh.
			if ( bStatus )
				wprintf(L"Text Changed\n");
			else
				wprintf(L"Text NOT Changed\n");
		}
		else
			wprintf(L"Font not found\n");

		return SUCCESS;	// apply changes
	}

 

The remapper attempt fails, and I get the "Text NOT changed" message. The font IS found.

 

Bruce

[CONNECT C++] TextBlock::FindText() linker headaches

$
0
0

I'm directly copying functions from the IncrementTextTool example into my code. One function calls textBlock->FindText()

private: bool IsSelectionValid(TextBlockPtr& textBlock)
{
	if (textBlock.IsNull())
		return false;

	WString regEx;
	TextBlock::FindTextParametersPtr findParams;
	// Setup for 'Find'-to search numbers in the string of the Text block using regular expression.
	SetupForFind(regEx, findParams);

	// Check if the string of the Text block has numbers.
	return (textBlock->FindText(regEx.c_str(), findParams.get(), textBlock->CreateStartCaret().get(), nullptr)).IsValid();
}

 

 

However, it doesn't link:

1>     Creating library C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\mdlapps_development/srs_changeFont.lib and object C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\mdlapps_development/srs_changeFont.exp
1>ChangeFontTool.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class Bentley::RefCountedPtr<struct Bentley::DgnPlatform::TextBlock::FindTextMatch> __cdecl Bentley::DgnPlatform::TextBlock::FindTextW(wchar_t const *,struct Bentley::DgnPlatform::TextBlock::FindTextParameters const *,struct Bentley::DgnPlatform::Caret const *,struct Bentley::DgnPlatform::Caret const *)const " (__imp_?FindTextW@TextBlock@DgnPlatform@Bentley@@QEBA?AV?$RefCountedPtr@UFindTextMatch@TextBlock@DgnPlatform@Bentley@@@3@PEB_WPEBUFindTextParameters@123@PEBUCaret@23@2@Z)
1>C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\mdlapps_development/srs_changeFont.dll : fatal error LNK1120: 1 unresolved externals

 

but when I build the example from the BMAKE file, it links and works fine. Why?? Could it have something to do with the a linker setting? It's obviously there in the .lib file... I've confirmed that I am including all the same lib files as the BMAKE is calling for.

 

 

Bruce

 

[Connect Update 5 C++] Trouble getting compiler to recognize windows files

$
0
0

Upgraded to the latest SDK for Update 5

I have installed VS 2015 since that is now required..now I am having a hell of a time getting the bentley compiler to recognize files like windows.h and winsock.h

fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

do I need to include the windows SDK paths in my make file?

Any help would be greatly appreciated!


[CONNECT C++] Use TextBlock::FindText() to locate "special" characters in a string

$
0
0

I'm using TextBlock::FindText() to locate text in strings. I can find letters and numbers just fine. I'm attempting to use Regular Expressions to find "Special" characters (like the "Copyright circle"). I've got the Unicode value I want to search for ( \u0169 ), but when I try to search, CONNECT just crashes:

#define REGEX_STRING_SEARCH L"\\x{0169}"

TextBlock::FindTextParametersPtr	findParams;
WString					regEx;
regEx.assign(REGEX_STRING_SEARCH);
findParams->SetUseRegularExpressions(true);
while ((foundRegion = textBlock->FindText(regEx.c_str(), findParams.get(), searchStart.get(), nullptr)).IsValid())
{
...
}

 

I'm sure its an issue of not supplying the proper search string for the Regular Expression. I haven't been able to find a C++  example via Google that I can try. I'll continue to search, but if the answer is known , please post it here.

 

Bruce

[CONNECTION C++]How do I lock the AccuDraw direction

$
0
0

I' m wanna to Draw a line,there have a opened AccuSnap  when I open the Draw Line Tool,so that can I catch a point  as a start point of a line.

Now I want to set a operation take effect,when the mouse moved to a grasped point,I need to extract this line and set the AccuDraw direction be paralleled with the line of the normol direction. The following are some codes and a picture, but the codes do not in the way I want to work!!

mdlAccuSnap_enableSnap(true);           //_OnPostInstall event

mdlAccuDraw_setEnabledState(true);   //open AccuDraw

//get Z

DPoint3d minPt, maxPt;
mdlSystem_computeDesignRange(&minPt, &maxPt, NULL, -1, NULL, NULL);

//mouse move

DPoint3d pt
pt.x = ev.GetPoint()->x;
pt.y = ev.GetPoint()->y;
pt.z = minPt.Z;

//extract the line,but I do not know How to give the third parameter

DSegment3d segment;
mdlLinear_getClosestSegment(&segment, &pt, &linearElm);

//get the line's normal

EditElementHandle eehline;
LineHandler::CreateLineElement(eehline, NULL, segment, true, *MASTERFILE);
mdlElmdscr_extractNormal(&vNormal, &pos, eehline.GetElementDescrP(), NULL);

//lock axis

Dpoint3d xAxisVec,pt1,pt2;
tmpPts.GetEndPoint(pt1);
tmpPts.GetEndPoint(pt2);
double length = mdlVec_computeNormal(&xAxisVec, &pt2, &pt1);
mdlState_setAccudrawContext(DgnPlatform::ACCUDRAW_SetNormal | ACCUDRAW_SetXAxis, &pt1, NULL, NULL, NULL, &xAxisVec);

Re: [Connect Update 5 C ] Trouble getting compiler to recognize windows files [MicroStation Programming Forum]

$
0
0
Maury,

Can you provide the buildoutput.txt and full developer shell environment variables list and values in a zip file to review? Good to hear the files needed exist.

Thank you, 
Bob

[MICROSTATION V8i SQLITE ODBC]

$
0
0

I 'm trying to connect MicroStation to SQLITE  by ODBC, but MicroStation don't see the table

Thanks

[V8i C++] Using Standard PUSHBUTTON_OK in Modal DialogBox

$
0
0

I've got a modal DialogBox that includes the built-in PushButtons PUSHBUTTON_OK and PUSHBUTTON_Cancel. I'd like to (somehow) attach a hook function to these so when they are pressed, I can do some checking. Can a hook callback somehow be attached in the DialogItem listing in the DialogBoxRsc?

{{2*XC, GENY(6.8), BUTTON_STDWIDTH, 0}, PushButton, PUSHBUTTONID_OK , ON, 0, "MyHookHere?", "MyHookThere?"},

 

Bruce

 

Viewing all 4331 articles
Browse latest View live


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