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

[CONNECT U8] mdlViewManager_loadSpriteFromRsrc() and mdlViewManager_createSpriteFromIcon()

$
0
0

Prior to CONNECT, I used to load a Sprite this way:

		int					iconID=101;
		HINSTANCE			myDll=GetModuleHandleW(L"srs_featPlcV2");
		m_oSpriteP = ISprite::CreateFromIconResource( iconID, myDll );	//NULL=ustation.dll

Now, attempting to perform the same in CONNECT:

		HINSTANCE			myDll = GetModuleHandleW(L"srs_revisiontriangle");
		ISpriteP			pSprite = nullptr;
		int					iconID = IDI_ICON1;
		pSprite = mdlViewManager_loadSpriteFromRsrc(iconID, &myDll);

returns a non-null "pSprite", but when I try to verify it's size (pSprite->GetSize(&size)), I get zero for the x and y size, which makes me believe the actual call to mdlViewManager_loadSpriteFromRsrc() failed. I have an icon embedded as a resource in the .dll code. I have opened the .dll file in Visual Studio and verified the icon IS there. How to properly "create" a Sprite? I also verified that the HINSTANCE returned from GetModuleHandleW() is not null.

Bruce


[CONNECT C++] How to compile CONNECT MDL app NON-Debug?

$
0
0

It seems that the default API setup (from MKI files) is to compile CONNECT C++ source with the /MD compiler switch which specifies debug code. I've been searching through MKI files for most of the day and cant figure out how to specify a non-debug build.

Is it possible to build a non-debug mdl app for connect and if so, how?

Thanks, Loren.

[Connect C++] API to remove hierarchy inside models and calculate correct attributes (color, transformation)

$
0
0

I am not sure if there is such capability in toolkit API but I want to ask since the platform API gives me many surprises till now. 

Say I have a MicroStation file within it is a 2D model, it could have geometries, cells and nested cells which could be very deep levels and can be represented with a tree structure with several levels. Is there any function in toolkit able to remove the hierarchy of a model and keep the leaf geometries with correct transformation, color those kind of attributes? 

I am asking this because there are some view purpose applications don't support hierarchy structure and only care about the visual results (position, transformation, color, visibility) . And from my understanding this is common in 2D models. 

Thanks,
Danny

[CONNECT C++] ECReportNode display label

$
0
0

Class ECReportNode has a GetDisplayLabel() method.  However, there is no way that I can see to set that display label.

[V8i SS4] Anyway to dynamically add tools to Task dialog?

$
0
0

I have searched the forum and found suggestions about using dgnlibs but this will not help in my case. I'm looking for a way to do this programmatically at runtime.

I have gone through Named Tools MDL functions but I dont see a function to achieve this.

One other way I am considering is to create an XML file on the fly and then load that hopefully via MDL api - as Workspace -> Customize and then File -> Import from XML - but cannot find relevant info.

I appreciate if someone could help.

Thanks

[CONNECT C++ U8] View Decorations

$
0
0

Now that CONNECT has the ability to load a "sprite", I'm trying to implement a view decoration that we use in V8i. It works - sometimes. The sprite always displays in view 0, but  will "most" time NOT display in the other views. If I initially start with the cursor in views 1-7, the sprite displays, but as I then move the cursor out of/into different views multiple times, the sprite will disappear, never to return. The code that uses the sprite display is not a primitive or elementSet type tool (should it be a "view" tool ? I've never done one before). A dialog box is opened where the user can pick settings (e.g. level/color/weight/style). The sprite displays the entire time the dialog box is loaded.

I use a MotionFunction, ViewMonitor, and ViewDecoration:

extern		bool					drawViewDecoration;
extern		DPoint3d				cursorLocation;
		ISpriteP				m_oSpriteP = nullptr;

extern	"C"		void		ViewMotionCallback( MSWindowP window, int xCoord, int yCoord )
{
	cursorLocation.x = xCoord;
	cursorLocation.y = yCoord;
	window->GetViewport()->SetNeedsRefresh();
}


struct				ViewDecoViewMonitor : Bentley::DgnPlatform::IViewMonitor
{
public:
	virtual void _OnViewEnterOrExit(ViewportP viewport, int changeType)	// note param changes
	{
		if (changeType == CHANGE_POINTERENTER)
			drawViewDecoration = true;
		else
			drawViewDecoration = false;
	}
};


struct MyViewDecoration : Bentley::DgnPlatform::IViewDecoration
{
public:
	MyViewDecoration()
	{
		int					iconID = IDI_ICON1;
		HINSTANCE			myDll = GetModuleHandleW(L"srs_featureOperations");
		m_oSpriteP = mdlViewManager_loadSpriteFromRsrc(iconID, (HINSTANCE*)myDll);
	}

	virtual bool _DrawDecoration(IndexedViewportR vp) override
	{
		if (!drawViewDecoration) 
		{
			wprintf(L"No ViewDecoration\n");
			return true;
		}
		else
		{
			wprintf(L"DO ViewDecoration\n");
		}
		// stuff to draw decoration is here. Just omitted for brevity
		return true;	// significance of "true" ??
	}

};

static		MyViewDecoration		m_oMyViewDecoration;
static		ViewDecoViewMonitor		m_oMyViewDecoViewMonitor;


I notice that the cursor decoration for "element selection" (i.e. the small locate circle at the tip of the cursor arrow) also disappears as my view decoration fails to display.

Bruce

How to speicify the keyin comands for C++/CLI addin for Microstation Connect Edition?

$
0
0

Hi Expert,

     I am new to Microstation addin develop, and i need to implement an simple addin(C++/CLI) for some functionality, currently i have follow some blogs to create an C++/CLI addin for Microstation Connect Edition,

the addin can be loaded successfully, but i  don't know how to add the keyin command for the addin, can any expert help me out here, thanks in advance.

   i create the addin with visual studio 2015, a CLR dll,  and the addin can load successfully with Microstation.  my quesiton is how i can specify the key in commands in my C++/CLI project with Visual studio 2015?

  

by the way, how i can attach my source code for the issue?

thanks,

Rick

    

Microstation V8i C++ SDK

$
0
0

I have installed the SDK “mssdk081109829en.exe”. The Microstation Programmer’s guide states that “Three wizards are included with the SDK that work in Visual Studio (2005 through 2010) to help developers create applications.”

As per the instructions provided,  I set the VSWIZARD to 8.0 and Wizard=VsWizard.VsWizardEngine.8.0. I also copied the relevant files to the path defined by Param="ABSOLUTE_PATH = c:\ddrive\data\wizards\MSTNToolWizard"

However I did not find any MDL Application entry when I open a new project in Visual Studio.( I have Visual Studio 2008 Express edition installed on my system).

 

Also I am trying to compile the code given under example <C:\Users\Username\Documents\MDLProjects V8i (SELECTseries  3)> using “BMAKE”, but it gives compilation error as

“BMAKE: Error - Attempting to build with VS 2005 but location is undefined!

BMAKE: call trace”

Is it mandatory to have Visual Studio 2005 Pro Edition to compile code written for Microstation V8i?


[ MicroStation V8i mdl ] question about MicroStation Console Window

$
0
0

Hello world,

Is there a way to access the MicroStation Console Window from mdl? I would like to minimize it.

For a moment I thought it is a dialog, findable by mdlDialog_find (using DIALOGID_CommandWindow, but that's something else, I now realize). But I now think the console is in another process, and maybe unreachable for mdl (although I found mdlSystem_getStringFromConsole(), but that's the only API interaction with it that I could find). Probably therefor, also my plan B of setting focus in mdl at mainview in order to get console to the background, doesn't work.

Alternatively: searching the forum, I ran into some environment variables: set MS_USECONSOLEROUTINES=0 and set MS_CONSOLELOG=fullfile . But they do not what I want. But maybe there are others. Would anyone know where is a complete list of environment variables for MicroStation (they are not WorkSpace variables).

best regards, Jan Willem

MDLwizard not shown in visual studio

$
0
0

After installind microstation SDK, I cannot find any wizard in visual studio.

Please help anyone. I need to buid a project with mdl application.

MVBA script on Aecosim

$
0
0

Hi All, 

Following up on a question i posted lately on the Aecosim BD forum, you can find it under the title 'scripts-add-ins-for-aecosim-building-designer'.

I don't have access to Aecosim SDK so i have to stick with mvba to write my code.

My design model consists of at least 800 contiguous smart solids, for each one of them i need to :

1 - extract the front and back surface

2 - Assign the coordinates of the edges of these surfaces in a variable

3 - Do some tasks based on these coordinates.

How can i scan the model for smart solids and go through them since the mvba doesn't have the element type smart solid? if this is not possible, is there a way to do these tasks by just selecting each smart solid manually and let the macro do the rest ?

Best regards.

[CONNECT C++] convert a smart solid to 2d plane by calling ConvertTo2d(), the generated curves are still in the 3d space

$
0
0

Hi Experts,

I have a model with a brep (such like a smart solid), when I convert it to 2d plane by calling void Handler::ConvertTo2d(EditElementHandleR eeh, TransformCR flattenTrans, DVec3dCR flattenDir), it generates a cell with several curves, but these curves are still in the 3d space.

If the target model is a mesh (such like a cone), the generated curves are in the same 2d plane which I set.

Can ConvertTo2d() deal with brep model? If not, how to deal with brep model in order to get the 2d copy of the 3d model in 2d plane?

Thanks.

Ancient basic macro to VBA

$
0
0

I've come across an old macro which supposedly does what I want -- list attached references in the drawing's print border.

As my programming skills are limited, can anyone tell me if it's going to take a lot of work to rewrite this?

Thanks

' macro refnsub.bas'---------------------------------------------------------------------'   A macro to replace a target text string with the names of all'   displayed reference files.''   The purpose for this macro is similar to text substitution used'   in resymbolization tables except that a reference file name is '   substituted instead of the active file name. '   '   You have the option of full path name or just the path name.  '   Due to the way this macro works, (a limitation of this programmer)'   all the susbstituted reference names temporarily reside in a single'   text line while the macro is running its course.  Since there'   is text line character limit, all the full path reference file names'   may not fit into this limit. When this happens, a truncated reference'   file names list results.''   After replacement, an UNDO MARK command'   reverses the text replacement.''   Set the case sensitive target string at the constant chk$ statement.'   make sure your target string has the correct justification and line'   spacing.  The target string can be within a multiline, but should'   appear as a single line.  The target should not be within a cell or'   group.''   "File not found" references will not be added.''   Set the full path reference name switch using the constant "yespath"'   statement''   The constant listprefix$ is text that preceeds the reference file list.'   Edit this prefix to your liking.''   This macro is meant to be altered by the user.  It is not a finished'   product and has not been used enough to discover quirks or bugs. There'   is vestigial code from other variations on this theme.''   Allan Seidel 4/22/98 akseidel@swbell.net''---------------------------------------------------------------------'   global home lot'---------------------------------------------------------------------

    Dim filePos as Long
    Dim iref as integer
    Dim ref as string
    Dim foundtxt as integer
   
    Const LF = chr$(10)
    
    Const yespath = 0   '= 1 for full path, = 0 for name only
    Const chk$ ="$SEARCHFORTHIS$"
    Const listprefix$ ="ATTACHED REFERENCE FILES:"+LF'---------------------------------------------------------------------'   main - Entry point'---------------------------------------------------------------------
Sub main
    Dim element as New MbeElement
    Dim etype as integer

    foundtxt = 0

    ' read the first element
    filePos = element.fromFile (0)
    Do While filePos >= 0' show element and nesting level
        etype=element.type
        Call ProcessElement (element)
        filePos = element.fromFile (filePos + element.fileSize)
   Loop 
        Select Case Foundtxt 
                Case 0
                    button = MbemessageBox ("Could not find the search string:"+LF+LF+chk$,2048)
                Case 1 ' remove comment to make plot automatically'Makeplot'MbesEndCommand "undo mark"'MbeSEndCommand "mark"' comment next line if plotted automatically
                    button = MbemessageBox ("Remember to UNDO MARK after plotting",1024)
                Case 2
                    button = MbemessageBox ("No Displayed Reference Files Found!",2048)
        End Select
End Sub'-----------------------------------------------------------------'   Does whatever need to be done to the text element'-----------------------------------------------------------------
Sub ProcessText (inElem as MbeElement )
    Dim origin as MbePoint

    foundtxt = 1
    assembleref
    If inElem.setString (ref) <> MBE_Success then
         MbeWriteError ("Unable to change string")
    Else

    If ref="" then' search string found but no logical name since ref =""' edit text crashes when ref = ""               
        foundtxt = 2    
    Else
        MbeSEndCommand "mark"
        stat=inElem.rewrite ()
        MbeSEndCommand "edit text"
        stat = inElem.getOrigin(origin)
        MbeSEndDataPoint origin,1%
        MbeSEndDataPoint origin,1%
        MbeSEndAppMessage "textedit" , "applybtn"
        MbeSEndCommand "null"
    End If
    End If

End Sub

'-----------------------------------------------------------------'   Checks If element is text, SEnds to processestext If it is'-----------------------------------------------------------------
Sub TextCheck (inElem as MbeElement)

    dim ts$ as String
    If inElem.type = MBE_Text Then
        If inElem.getString (ts$) = MBE_Success Then
          If ts$=chk$ then
             ProcessText inElem
          End If
        End If
    End If

End Sub

'-----------------------------------------------------------------'   Processes simple elements'-----------------------------------------------------------------
Sub ProcessElement (inElem as MbeElement)

    Dim gotNext as Integer
    Do
      ' call function that checks element at current position
        Call TextCheck (inELem)
        gotNext = inElem.nextComponent
    Loop While gotNext = MBE_Success

End Sub

'-------------------------------------------------------------'   AssembleRef - puts together the ref text string'-------------------------------------------------------------

Sub AssembleRef

  For iref = 1 to mbereffiles.maxreffiles
    If mbereffiles(iref).active <> 0 then
      If (mbereffiles(iref).display = 1) and (mbereffiles(iref).notfound = 0) then

        If yespath = 1 then
          refname$=fileparse$(mbereffiles(iref).filename,0)
        Else
          refname$=fileparse$(mbereffiles(iref).filename,3)
        End If
    
            If ref = "" then
                ref = listprefix$+refname$
            Else
                ref = ref +lf+ refname$
            End If

      End If    
    End If
  next

End sub

'-------------------------------------'   Makeplot plots the file'-------------------------------------'   This is just a start on the plotting process. There'   should be commands added to set the correct plotter,'   set the correct paper size, scale, correct levels etc.' 
Sub MakePlot
    MbeSendKeyin "view on 1"
    MbeSendKeyin "place fence allfiles"
    MbeSendKeyin "selview 1"
    MbeSendKeyin "plot fence"
    MbeSendKeyin "plot"
    MbeSendCommand "_PLOT _EXEC _PLOT "
End Sub

[Connect C++ ]_ProcessAsFacets is font dependent?

$
0
0

I asked this but seems got lost in the long thread, so I want post this in a new topic:

We tried _ProcessAsFacets() way for text tessellation, in most case it works fine. One thing we noticed is in some case the text tessellation failed and we suspect it's due to the machine missing font used in MicroStation design file. Is it the case? If so what's the suggestions for it?

One example is we created some text in one machine installed MicroStation and try tessellate it in another machine (Without MicroStation installed), the tessellation result failed. 

[CONNECT U8 C++] Adding Item to Element Template Programatically (continued)

$
0
0

I'm using a method I referenced in 

[CONNECT C++] Adding Item to Element Template

to "add" an Item to a Element Template so that when the template is activated and an element is placed, the element gets the Item data as well as the other template parameters. As Paul mentioned:

Paul Connelly said:
"That will sort-of work, except there is a specific flag that must be set on the ECInstance indicating it is an Item attached to a Template, which enables template-specific behavior.
Without that flag, you may find some things don't work as you expect."


Well.. I *think* I may have just run into that situation. When I activate my template, when I place a line, I get the template parameters, but NOT the Item applied to the element. If I activate the Element Template Association lock, when I place a line, MicroStation "hangs" for a few seconds, then aborts. The error log shows the last thing performed:

Bentley::ECN::ECSchema::ReComputeCheckSum

So, I'm wondering if this crash is related to what is noted by Paul. The initial post was a few "updates" back, so is that comment still appropriate?

Bruce

Exception String: 'Access Violation'

Memory Statistics for process ID 22344:

24473 MB Total Phys
14146 MB Avail Phys
49049 MB Total Page File
39633 MB Avail Page File
134217727 MB Total Virtual
134216000 MB Avail Virtual
0 MB Avail Extended Virtual

504 MB PeakWorkingSetSize
504 MB WorkingSetSize
591 MB PagefileUsage
763 MB PeakPagefileUsage

373326 PageFaultCount
1575168 QuotaPeakPagedPoolUsage
1550128 QuotaPagedPoolUsage
209864 QuotaPeakNonPagedPoolUsage
192320 QuotaNonPagedPoolUsage

621 GDI Objects
184 USER Objects


Wrote a mini-dump type 0x4 to "c:\Temp\Bentley\MicroStation\10.0.0\MiniDump.dmp".
Stack dump:
Exception: 0xc0000005 @ 0x3f76f5d9
0: 00000016a2ffd090 00007ffa2ce8a7e2 fffffffffffffffe ffffffffffffffff 0000013fe1b4d298 00007ffa2c9bd4c9 Bentley::ECN::ECSchema::ReComputeCheckSum+0x19
1: 00000016a2ffd110 00007ffa2d336b79 0000000000000000 0000000000000000 00000016a2ffd1c9 0000013feb74f548 Bentley::DgnPlatform::DgnECManager::ImportSchema+0x62
2: 00000016a2ffd220 00007ffa2d30da17 0000013f00000000 0000001600000001 0000013fe8da1e28 0000013f8fb4d778 Bentley::DgnPlatform::XDataTreeOwner::GetStandaloneECEnabler+0x359
3: 00000016a2ffd2f0 00007ffa2d30d813 00000016a2ffd3e8 0000013fe2091fb8 000000000000048c 00007ffa2d30dc00 Bentley::DgnPlatform::ElementTemplateNode::CreateNode+0x1e7
4: 00000016a2ffd350 00007ffa2d30e221 0000013f8fb4d6a0 0000013fe2091fb8 00000000583b0001 0000013fe2091fb8 Bentley::DgnPlatform::ElementTemplateNode::CreateNode+0x63
5: 00000016a2ffd3c0 00007ffa2d3259bc 00000016a2ffd4e8 0000000000000001 0000013fe98e8ae0 00007ffa00000014 Bentley::DgnPlatform::ElementTemplateNodeHandler::GetHandlerId+0x231
6: 00000016a2ffd420 00007ffa2d3358b9 00007ffa2d49a700 0000013feb1ee160 0000000000000001 0000013f8fb4d6a0 Bentley::DgnPlatform::IXDataNodeHandler::CreateNode+0x4c
7: 00000016a2ffd570 00000000704604a5 0000013feb74f548 0000013feb74f548 0000013feb1ee160 00000000583b0001 Bentley::DgnPlatform::XDataTreeOwner::CopyNodeFromFile+0x559
8: 00000016a2ffd5f0 00000000704608be 0000013feb1ee160 00000016a2ffd660 00000016a2ffd728 00000016a2ffd728 Bentley::MstnPlatform::MstnElementTemplateMgr::CopyTemplateToFile+0x95
9: 00000016a2ffd680 000000007045f119 0000013fe97f3b90 0000013feb1ee160 00000016a2ffe401 0000013feb824ac0 Bentley::MstnPlatform::MstnElementTemplateMgr::CreateFromExisting+0x23e
10: 00000016a2ffd710 00007ffa2f36ebee 0000013fe97f3b00 0000000000000000 0000013fe97f3b90 00000016a2ffd799 Bentley::MstnPlatform::MstnElementTemplateMgr::AddActiveTemplateReference+0x79
11: 00000016a2ffd7f0 00007ffa2f370372 0000013fe97f3b90 00000016a2ffd8c8 3f765e72c3b3902d 0000000000000000 Bentley::UIFramework::BSize::operator=+0x88642
12: 00000016a2ffd850 00007ffa2f372a1b 000000007107c4b0 00000016a2ffdb20 00000016a2ffe460 40bd3366d42b8c78 Bentley::UIFramework::BSize::operator=+0x89dc6
13: 00000016a2ffd890 000000007084d53a 000000007107c4b0 00000016a2ffe460 0000000000000000 000000007086f96a Bentley::UIFramework::BSize::operator=+0x8c46f
14: 00000016a2ffd8e0 00000000703ea0af 0000013fe1e376c0 00000016a2ffe460 0000000000000000 407e000000000000 SystemCallback::SetWorkspaceChangedFunction+0xc0a
15: 00000016a2ffd910 00000000703eab7d 000000007107c4b0 00000016a2ffdb20 00000016a2ffe460 00000016a2ffdb20 Bentley::DgnPlatform::DgnTool::SetCmdNameAndPromptByString+0x19ff
16: 00000016a2ffd9b0 00000000709515d8 000000007107c4b0 0000000000000002 00000016a2ffe401 00000000e41f82d8 mdlState_startInputGenerator+0x22d
17: 00000016a2ffd9e0 00000000709513f7 00000000e41f82d8 00000016a2ffda01 00000016a2ffe460 01d3d189fafe3d0d mdlSystem_parseFileNameAndModelName+0x1888
18: 00000016a2ffda10 000000007094bd37 0000000000000000 3b00000000000000 0000000000000000 00007ffa6a10be53 mdlSystem_parseFileNameAndModelName+0x16a7
19: 00000016a2ffe400 000000007094fad5 00000016a2ffe460 0000000000000001 0000013fc4169418 00007ffa644240e0 priorityGui_initialize+0xe17
20: 00000016a2ffe430 00000000707ebd34 00000000707ed110 00000000707ed110 0000000000000000 0000000000000000 mdlInput_processQueuedInput+0x25
21: 00000016a2ffe470 000000007088e09e 365e7659e72b0000 0000000000000009 fffffffffef29e19 000000006fa2a5f4 mdlInput_handleModifierTransition+0x124
22: 00000016a2ffe4b0 000000007088fea3 000000007107c4b0 0000013fe11f1d50 0000000000000003 0000013fc4162530 Bentley::MstnPlatform::ISessionMgr::SetSnapsPopupGroupKeyin+0xcee
23: 00000016a2ffe500 00000000709111e3 0000013fc4162530 0000013fc1d43f4c 0000000000000000 0000000000000000 mdlSystem_recordUserActivity+0x223
24: 00000016a2ffe740 00007ff6d8db5570 ffffffff8b011764 00007ff6d8db0000 0000013fc1d43f4c 0000000000000001 win32Intface_winMain+0xb3


How to load the addin(C#) automatially when the Microstation Connect Edition luanched and a dgn file is opened?

$
0
0

I have a C# addin for Microstation(CE), i can load the addin manullay, i want to the addin load automatically when Microstation launched and a dgn file is opened?

i have search the related issues, and seems is need to set MS_DGNAPPS variable, but i am not sure where this variable is? do i need to add this environment variable?

thanks for your help in advance.

How to add a UI command button for a key-in command in my addin?

$
0
0

 I have a addin(C#) which can load to Microstation(CE), and i known by customize the .dgnlib, i can add a UI ribbon command(button) for the key-in commands?

but i am not sure how to do that kind of UI customization with Microstation(CE),  is there any help document regarding customize the UI commands with key-in commands?

thanks,

Rick

[CONNECT] ItemType question

$
0
0

I'm trying to better understand ItemTypes. I've defined an ItemType Library in a .dgnlib file. I *think* that in order to utilize (i.e. read the definition and store on an element) an ItemType, the definition (i.e. Schema) needs to be copied from the .dgnlib into the current DGN file. How is that done? When I was using XAttributes, I had to read an .xml file into the dgn file to "load" the schema. Is this the only way?

Bruce

mstn V8i Addin根据临时坐标系旋转CellElement,并能按照临时坐标系中的某一个轴动态旋转

$
0
0

各位大神!我用Addin的方式画了一个CellElement后,想根据临时坐标系旋转我的CellElement并能按照临时坐标系中的某一个轴动态旋转,应该用哪些方法。谢谢!

我用了以下方法,然而CellElement并没有旋转,请大家帮我这个小白看看!

mdlCurrTrans_begin();
mdlCurrTrans_getTransforms(ref pMdlToUor, ref pUorToMdl);
mdlCurrTrans_rotateByRMatrix(pMdlToUor,1);
mdlCurrTrans_invtransRMatrix(ref rMatrix1, rMatrix);

Get HANDLEID of an element

$
0
0

how can we get handleid of an element in microstation using c++?

Viewing all 7260 articles
Browse latest View live


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