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

[CONNECT .NET] AddIn load and unload events

$
0
0

C++ programmers can implement event handlers to monitor application load and unload events.  For example, if I want to clean up resources when my app. is unloaded I can write a C++ callback (.NET delegate) for SystemCallback::SetUnloadProgramFunction (OnUnload).

In the .NET API I can see a number of Session events (e.g. Session.OnModelRefActivate).  What I can't see are the equivalent events for OnMdlReload and OnMdlUnload.  Do they exist for .NET?


Microstation Scripts

$
0
0

I am looking at getting into porgramming some microstation scripts.

Currently i could do with a script that will turn off / on levels that have been pre-determined.

What would be the best way to go about this.

[MS Connect Edition C++] mdlClip_element() crashes with non persistant element

$
0
0

Hi everybody,

I use the function mdlClip_element with a non persistant element for the inputEdP and the function crashes.
In the follwing code, DynAccroElmDscrP is non persistant.


if (mdlClip_getFence(clipP) == SUCCESS)
{
mdlElmdscr_new(&DynAccroElmDscrP, NULL, eeh.GetElementCP());
// the following line crashes
mdlClip_element(InsideElmDynDscrPP, OutElmDynDscrPP,DynAccroElmDscrP, ACTIVEMODEL, clipP.get(), vue);
}

With the following code, everythink is ok

      if (mdlClip_getFence(clipP) == SUCCESS)
      {
        mdlElmdscr_addByModelRef(DynAccroElmDscrP, ACTIVEMODEL);
        mdlClip_element(InsideElmDynDscrPP, OutElmDynDscrPP,
          DynAccroElmDscrP, ACTIVEMODEL, clipP.get(), vue);
      }

But the problem is that I don't want to add this ElementDescr immediatly.

Thank's for your help!

Regards,

Hervé

[CE U9 VBA] iLocateCommandEvents

$
0
0

MicroStation CE 10.9.1.1. VBA Code.  I have implemented an iLocateCommandEvent class, it has a locatefilter and an accept function (and others). When the user selects and element it highlights, and then the user can accept - normal behavior. The accept function runs and does what it needs BUT the location of the accept click is passed on (relived). The accept click will decide to place a cell or show a dialog depending on what was picked. Because the accept click is not consumed, it will either a) select the newly placed cell as a continuation of the same vba ilocatecommandevent or b) select a button on the dialog.  How can I prevent the accept click from persisting as the accept function is executing?

[MSCE U13 C#] How to set an Element as "unclickable"?

$
0
0

Hi all,

I'm wondering if there's a way to set an Element as "unclickable" programmatically.

Not "locked" nor "invisible": visible, but not selectable.

Thanks.

[AECOsim V8i SS6 C++ TriForma] Adding a DataGroup[DG] to an existing element leads to Access Violation.

$
0
0

Hi,
There are still a lot of V8 installation in the world, so I would like to extend some Elements with DG in V8. There is a sample “DGExamples” of low quality (unused functions, magic texts, link issues, etc.) as documentation. After reading and understanding (hopefully) the core of this sample, I got these few lines to add something to an existing element:


if (SUCCESS == mdlAssoc_getElementDescr(NULL, &ulFilePos, ullSchaleElmId, pModelRef, TRUE))
{
   ElementRef ElmRef = mdlModelRef_getElementRef(pModelRefReal, ulFilePos);

   if (NULL != ElmRef)
   {
      Bentley::Building::Elements::BuildingEditElemHandle beeh(ElmRef, pModelRef);
      std::wstring _catalogTypeName;
      std::wstring _catalogInstanceName;

      _catalogTypeName = L"Door";
      _catalogInstanceName = L"x_Single Flush Panel";

      beeh.GetCatalogCollection().InsertDataGroupCatalogInstance(_catalogTypeName, _catalogInstanceName);
      beeh.GetCatalogCollection().UpdateInstanceDataDefaults(L"Door");


      //std::wstring const itemXPath = L"Door/Door/@DoorMaterial";
      //std::wstring const itemValue = L"Wood";
      //CCatalogSchemaItemT* pSchemaItem = NULL;
      //if (NULL != (pSchemaItem = beeh.GetCatalogCollection().FindDataGroupSchemaItem(itemXPath)))
      //   pSchemaItem->SetValue(itemValue);

      nRetErfolg = beeh.Rewrite();;
   }
}

This is just to test, and yes, ElementHandle and ModelRefP are valid, and I know, I uses magic-text, too 


Beeh seems to contain something, and beeh.GetCatalogCollection() does not return NULL or something funny.


But InsertDataGroupCatalogInstance() will throw a really heave exception with memory violation at 0x05.


Seems there is missing some initialization, but I did not find something in the help or sample.

What could I do?

MicroStation SDK U13 issues.Visual Studio 2017 Professional

$
0
0

Something probably goes wrong during installation. Buildallexamples fails with this error:

Wed Oct 16 11:18:29 2019, elapsed time: 0:00
BMAKE: Error - Cannot find the .Net framework 64-bit version for this toolset. VS2017_FrameworkVersion64 was not defined, and registry lookup failed. FrameworkVer64
BMAKE: call trace
line: 136, C:\PROGRA~1\Bentley\MICROS~2\mki\VCVarsQueryRegistry2017.mki

The two missing reg keys are:

\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7, "FrameworkVer64"
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VC7", "FrameworkDir64"

What am i doing wrong?

[C++ Connect] Exception when using mdlSystem_enterGraphicsExtended(0)

$
0
0

Hi everybody,

We launch our MDL application directly with Ustation using the configuration variable MS_INITAPPS > c:atlog/SYSTEME/profil.ma

Since the migration to Connect Edition, we have an exception in VS2017 on the line

mdlSystem_enterGraphicsExtended(0)

Join with the post, there is a little project which shows the problem.

Thanks for your help,

Hervécommunities.bentley.com/.../Profil_5F00_Connect.zip


[Connect C#] Running Version 13 with Net Framework 4.6.2 - Excel cell format

$
0
0

I need to get format information for Excel cells (fill color, alignment, etc) using Bentley.General.Excel.ExcelFormatConditions

ExcelCell exCell = ActiveSheet.GetCell(1, 2);
ExcelFormatConditions exCellFormConds = exCell.FormatConditions;
for (int i = 0; i < exCellFormConds.Count; i++)
    {
    ExcelFormatCondition excFC = exCellFormConds[i];
    string tempStr = excFC.ToString();
    }

Can anyone tell me if the format conditions contain cell's color, alignment, etc... information?  Thank you

[CONNECT .NET] TextTableDataSource has no members!

$
0
0

.NET class TextTableDataSource has no members other than those inherited from its base class.  It's name implies usefulness, but what can we do with it?

[CONNECT] TextTable Seed

$
0
0

MicroStation lets a user define a DGN model that acts as a TextTable seed.  The APIs include a TextTable class, having a static Create method and a CloneAsSeed method.  It's not obvious how we might create a TextTable from a seed model programmatically.

Any suggestions?

[CE U13] Problerm with DgnElementSetTool not acting as expected

$
0
0

I've got a simple DgnElementSetTool that is not behaving as I expect. Ideally the tool would act like the Delete Tool in regards to selecting elements - one click and done. However, I cannot get the tool to act that way. What happens is that the first click picks my element and processes it, leaving the element altered, but still hilited. subsequent clicks in the model continue to change the element, but it is not until I perform a Reset does the element release (un-hilite).  At this point I'd be happy to get the tool to work like the MicroStation ChangeColor tool - one click to pick the element, second click to "accept" the change and "release" (un-hilite) the element. I'm sure it's something simple I'm missing...

 

#include	"stdafx.h"


struct          Tool : public DgnElementSetTool
{
private:

public:
	Tool(UInt32 toolId, UInt32 toolPrompt)
		: DgnElementSetTool()
	{
	}


private:	bool		_WantDynamics() { return false; }
private:	bool		_NeedAcceptPoint() { return false; }



private:	StatusInt  _OnElementModify(EditElementHandleR eeh) override
{
	wprintf(L"_OnElementModify\n");

	ElementPropertiesSetterPtr			pSet = ElementPropertiesSetter::Create();
	pSet->SetColor(1);
	//pSet->SetChangeEntireElement(true);
	pSet->Apply(eeh);

	return SUCCESS;
}


private:			void		_OnRestartTool() override
{
}

public:	static		void		InstallNewInstance(UInt32 toolId, UInt32 toolPrompt)
{
	Tool* tool = new Tool(toolId, toolPrompt);
	tool->InstallTool();
}
};	// end of Tool


extern	"C"	DLLEXPORT	void	ToolCommand(WChar	*args)
{
	Tool::InstallNewInstance(CMDNAME_NameText, 0);
}

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(43,5): warning MSB8005: The property 'NMakeBuildCommandLine' doesn't exist. Skipping...

$
0
0

Just starting out . . . Previous limited experience using V8i MDL.

Trying to get started to do some converting of my V8i mdl apps to Connect.  Battling to get the environment set up.

I have VS2017 Installed.

Connect SDK (v10.13.00.48) builds all examples successfully.  I had to download .NET Framework 4.6.2 to get it to eventually work.

'devenv' invokes VS2017 ok.

When trying to "Build" MyApp.sln, the following error occurs.

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(43,5): warning MSB8005: The property 'NMakeBuildCommandLine' doesn't exist. Skipping...

Any ideas please?

[CONNECT] Use Report as a Data Source

$
0
0

We can create a DGN Table using a Report as a data source.  However, that connection is a black box with no public access.

Is there a way in which we can connect to a Report programmatically, in order to use it as a data source?  I'm thinking a generalised connection in some way related to a .NET DataTable.

[CONNECT vba] bold text element

$
0
0

I must be missing something. all i want to be able to do is take all selected text elements and bold them. But i appears this is only possible if a text style has not been used

there is apparently no way to do this in bulk using any microstation tools. the modify text attributes does not have bold as an option. the best you can do is update a text style and save that, then switch all the text to that text style. but this causes problems because we have special symbols in a different font but then regular text uses aerial. so applying a text style switches all text to the font specified in the text style which then makes the special symbols display as a box (as aerial font doesnt have that symbol). So i thought why not just loop through selected elements and bold it. but my code below will only bold the text if the text style is set to none.

I can open the text editor for a given text element and hit the bold bottom to bold the text no matter what textstyle is set and that text style itself is not modified. (that would be bad if it did because then all elements using that text style would get updated automatically.) so its possible to achieve what i want via text editor but i need to do that in bulk.

So something as basic as bulk bolding text doesnt seem possible

here is my code. 

    Dim oEE As ElementEnumerator
    Dim intNumSel As Integer
    intNumSel = 0
    Set oEE = ActiveModelReference.GetSelectedElements
    Do While oEE.MoveNext
        If oEE.Current.IsTextElement Or oEE.Current.IsTextNodeElement Then'count the elements
            intNumSel = intNumSel + 1
            If oEE.Current.IsTextElement Then
                oEE.Current.AsTextElement.TextStyle.IsBold = True
                oEE.Current.Rewrite
            ElseIf oEE.Current.IsTextNodeElement Then
                Dim eeText As ElementEnumerator
                Set eeText = oEE.Current.AsTextNodeElement.GetSubElements
                Do While eeText.MoveNext
                    eeText.Current.AsTextElement.TextStyle.IsBold = True
                    eeText.Current.Rewrite
                Loop
                oEE.Current.Rewrite
            Else
            End If
        Else
        End If
    Loop

any ideas


[CONNECT/C++] mdlState_startPrimitive different from MicroStation's primitive?

$
0
0

1) My application is using mdlState_startPrimitive() for a simple command to get a user's input datapoint. 

2) We are using a 3rd party MDL application (terrasolid's tScan) that somehow changes/drapes the Z to sit on our lidar surface (I say somehow because the terrasolid developers have not responded to my queries on how they adjust it)

3) The primitive "place smartline" and other MicroStation commands recognizes the Z change however my custom command does not and only receives the active Z. 

4) If I use StateCallback::SetDataPointFunction(AcceptFunction); and StateCallback::SetResetFunction(MyPrimitive); instead of mdlStartPrimitive() my command see's the adjusted coordinate.

So my question is: How do the place smartline and other built in MicroStation primitive command's initialization logic differ from the logic used for mdlState_startPrimitive?

Merging two line strings from VBA

$
0
0

Hello,

I am using Microstation CONNECT update 12 (version 10.12.00.40). I am writing macro to look for snapped line strings (two lines with the same end node).  I would like to merge these pairs into one line string. I found  CreateComplexStringElement. I can’t use it since I need to keep my line work as Line strings.

The only solution which I can think of is to extract vertices from both line strings, create a new line string using all vertices and then delete my old lines strings.

Is there any other way how to do this without rewriting all lines I am merging? I was looking for function CreateComplexChain with flag for Simplify geometry.

 

[V8i SS4] Where are the TCB expressions listed?

$
0
0

Yes, I probably have the nomenclature wrong...
I remember being able to use the C expressions for the TCB to set all sorts of values, but it was a very long time ago (MicroStation Basic days).

Is there anywhere in the plain MicroStation install package where I might find a list of all those?
Thank you.

MaryB

[v8i C] Where is mdlFile_rename() function?

$
0
0

Hi,

mdlFile_xxx functions are really valuable. Most of the functions are in operating system level and you can reach from MDL. But some of them are missing like mdlFile_rename() and mdlFile_delete(). Why?

What I want to do is to rename MS_CONSOLELOG file because it starts writing on the same file every time you start the application. When you check MS_CONSOLELOG file it may contain several session outputs. I thought to rename the previous file on startup and start writing a new file. I don't know how to use Windows SDK functions yet. :)

NameDescription
mdlFile_abbreviateNameAbbreviates a filename to a specified length
mdlFile_abbreviateNameExAbbreviates a filename to approximately specified length
mdlFile_buildNameCreates a file name from the components specified
mdlFile_buildNameWCreates a file name from the components specified
mdlFile_buildPackagedFileNameWBuild a packaged filename of the format "packageNameembedName
mdlFile_buildSeparatedListConcatenates a list of strings using specified separator
mdlFile_buildSeparatedListWConcatenates a list of strings using specified separator
mdlFile_compactPathShortens a file path string to be no longer than the specified number of characters
mdlFile_compactPathWShortens a file path string of wide characters to be no longer than the specified number of characters
mdlFile_copyCopies a file
mdlFile_createGets the full file path for a file that an application may then want to create
mdlFile_createWatchListCreates a list of files to watch for changes
mdlFile_deleteWatchListDiscards a file watch list
mdlFile_findFinds the full path for an existing file
mdlFile_findExtFinds the full path for an existing file
mdlFile_findFilesCollects information on files matching the specifications provided
mdlFile_findRelativePathFinds the relative path from a root file to the target file
mdlFile_findRelativePathWFinds the relative path from a root file to the target file
mdlFile_getDiskFreeGets the number of free bytes on a file system
mdlFile_getDriveReturns the current default drive number
mdlFile_getFileAttributesGets the attributes of the specified file
mdlFile_getTimeStampreturns modified timestamp of specified file
mdlFile_getWatchedFileChangesCalls the user supplied function for each change to the list of files in the watchList
mdlFile_getcwdgets the name of the current working directory
mdlFile_isSameFileCheck if two fully qualified file-names represent the same physical file
mdlFile_isUntitledDesignDetermines whether the file name represents an untitled file
mdlFile_isValidDriveChecks to see if a drive is valid
mdlFile_mkdirCreates the new directory specified
mdlFile_parseNameParses a file name into its components
mdlFile_parseNameListParses a file name into its components
mdlFile_parseNameListWParses a file name into its components
mdlFile_parseNameWParses a file name into its components
mdlFile_parsePackagedFileNameWParse an packaged filename of the format "packageNameembedName
mdlFile_quoteStringAdds leading and trailing quotes to a string
mdlFile_resolveRelativePathWGenerates a fullpath by resolving relativeFileName relative to basePath
mdlFile_setDefaultShareSets a file sharing mode used by fopen when opening a file for the MDL task
mdlFile_setDriveEstablishes a new default drive for file system operations
mdlFile_setTimeStampset modified and last-accessed timestamp of specified file
mdlFile_unquoteStringRemoves the leading and trailing quotes from a string
mdlFile_updateWatchListAdds or removes a file from a watch list
mdlFile_validDesignFileTests whether the specified file is a valid MicroStation design file
mdlFile_validDesignFileWTests whether the specified file is a valid MicroStation design file

WHAT IS THE CODE TO SET THE FONT STYLE, FONT HEIGHT, FONT WIDTH, FONT COLOR IN MICROSTATION ?

$
0
0

WHAT IS THE CODE TO SET THE FONT STYLE, FONT HEIGHT, FONT WIDTH, FONT COLOR IN MICROSTATION ?

I am trying to set the font while fetching the data from the design and pasting in particular template.

Can someone please help me through this.

Find the piece of code which i have tried but its not working. Any other options or some code which i can try?

**********************CODE***********************************

 point.X = startPoint.X
    point.Y = startPoint.Y
    point.Z = startPoint.Z
    
    point2.X = point.X + 45
    point2.Y = point.Y + 3.8
    point2.Z = point.Z
    
    CadInputQueue.SendDragPoints point, point2, 1
    
    CadInputQueue.SendCommand "CLIPBOARD COPY"

    MicroStationDGN.OpenDesignFile FDFdFdFile, False, msdV7ActionUpgradeToV8
    
    CadInputQueue.SendCommand "FIT VIEW EXTENDED 1"
    
    CadInputQueue.SendCommand "SCALE ICON"

    CadInputQueue.SendCommand "ACTIVE XSCALE 1.0000"

    CadInputQueue.SendCommand "ACTIVE SCALE"

    CadInputQueue.SendCommand "ACTIVE YSCALE 1.0000"
    
    CadInputQueue.SendCommand "ACTIVE SCALE"
    
    CadInputQueue.SendCommand "TEXTSTYLE ACTIVE ROMANS"
    
    CadInputQueue.SendCommand "TEXTSTYLESET ColorValue ""7"" ""ROMANS"""
    
    CadInputQueue.SendCommand "TEXTSTYLESET Height " & Str(5) & "ROMANS"""
    
    CadInputQueue.SendCommand "TEXTSTYLE ACTIVE"
    
    CadInputQueue.SendCommand "TEXTSTYLESET WIDTH 5"
    
    CommandState.StartDefaultCommand

Viewing all 7260 articles
Browse latest View live


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