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

Re: [Connect SDK update 5] Errors when including PointCloudApi.h [MicroStation Programming Forum]

$
0
0
Artur,

Take a look for OrientedBoxCR on communities. You should find:

1. A 2nd thread on the same topic posted by the same user within a couple hours of the first/this.

2. An older issue with the same compiler error and suggested fix reported to have worked. So I  think this is related to the user using 2013 and the correct library versions/signatures not being found vs header order. This point was asked to be updated when the user could confirm. 

That is what I had assessed the issue state to be last night before leaving, but did not get to clean up and respond to.

Hth,
Bob


Sent from my Sprint Samsung Galaxy S7 edge.

-------- Original message --------
From: Artur Goldsweer <bounce-8620A4E9-3B43-4C56-B86D-3D2552E440E5@communities.bentley.com>
Date: 6/28/17 5:29 AM (GMT-05:00)
To: MicroStationProgramming@communities.bentley.com
Subject: RE: [Connect SDK update 5] Errors when including PointCloudApi.h [MicroStation Programming Forum]

 

 Message from Bentley Communities
Artur Goldsweer

Hi,

the Defect #64166 is not yet fixed with Update 5.


The error messages related to "OrientedBoxCR" could be caused by including PointCloudClipHandler.h, but without including previous DgnPlatformAPI.h.

Could you please give us an overview about your inlcuded Headerfiles and the order they are included?

Thanks

Artur

View online

If you encounter issues clicking "View online", check here.

 

You received this notification because you are subscribed to the forum.  To unsubscribe from only this thread,go here. To unsubscribe from a forum, please see this note.

Flag this post as spam/abuse.


[CONNECT C++] Issue with TextBlock->FindText() and TextNode Elements

$
0
0

I have encountered an issue with the use of TextBlock->FindText() when the TextBlock is from a TextNode element, The issue is obscure, and I am including a reproducible "test case". The testing function is:

void        ChangeFont_newTest(EditElementHandleR eeh, ITextEditP textEdit, DgnFontCP newDgnFont)
{
    T_ITextPartIdPtrVector              textPartIds;
    textEdit->GetTextPartIds(eeh, *ITextQueryOptions::CreateDefault(), textPartIds);
    for each (ITextPartIdPtr textPartId in textPartIds)
    {
        TextBlockPtr                textBlock = textEdit->GetTextPart(eeh, *textPartId);
        if (!textBlock.IsNull())
        {
            if (textBlock.IsValid())
            {
                if (!textBlock->ToString().empty())
                {
                    // loop thru each Run
DgnFontCP newDgnFont = DgnFontManager::FindSystemFont(L"Century Gothic"); if (newDgnFont->IsValid()) { RunPropertiesR runProps = textBlock->GetRunPropertiesForAddR(); runProps.SetFont(*newDgnFont); // -> CRASHES ON LAST LINE OF TEXTNODE- why ??? textBlock->SetRunPropertiesForAdd(runProps); } int runIndex = 0; CaretPtr runCaret = textBlock->CreateStartCaret(); do { RunCP run = runCaret->GetCurrentRunCP(); wprintf(L"Run %d [%s]\n", runIndex, run->ToString().c_str()); // use regex search/replace TextBlock::FindTextParametersPtr findParams; TextBlock::FindTextMatchPtr textMatch = nullptr; findParams = TextBlock::FindTextParameters::Create(); findParams->SetUseRegularExpressions(true); findParams->SetMatchWholeWords(true); CaretPtr startCaret = runCaret->Clone(); CaretPtr endCaret = runCaret->Clone(); if (BentleyStatus::ERROR == endCaret->MoveToNextRun() ) { endCaret = textBlock->CreateEndCaret(); } WString regEx(L"[e]"); // while ((textMatch = textBlock->FindText(regEx.c_str(), findParams.get(), startCaret.get(), endCaret.get()/*nullptr*/)).IsValid()) { CaretCR matchStart = textMatch->GetMatchStart(); CaretCR matchEnd = textMatch->GetMatchEnd(); CaretPtr replacementEnd = matchEnd.Clone(); CaretPtr insertCaret; wprintf(L"Match Found\n"); insertCaret = textBlock->Remove(matchStart, *replacementEnd); replacementEnd = textBlock->InsertText(*insertCaret, L"X"); //textBlock->ReplaceText(L"X", matchStart, *replacementEnd); // WORKS - But cannot change font... startCaret = replacementEnd; // matchEnd invalidated } // end of regex wprintf(L"End of Run %d\n", runIndex); runIndex++; } while (BentleyStatus::SUCCESS == runCaret->MoveToNextRun()); textEdit->ReplaceTextPart(eeh, *textPartId, *textBlock); } // if (!str.empty()) } // if (textBlock.IsValid()) } // if (!textBlock.IsNull()) } // for each (ITextPartIdPtr textPartId in textPartIds) } // void ChangeFont_newTest(EditElementHandleR eeh, ITextEditP textEdit, DgnFontCP newDgnFont)

 

 

The issue can be seen when there is a multi-line TextNode, such as:

      This is Line One

      This is Line Two

      This is Line Three

      This is Line Four

 

If you set the regex variable to search for L"[e]", all the "e" will be changed to "X" using "Century Gothic" (in this case). However, if you change the regex variable to any character that is on the last line (final paragraph), CONNECT will crash (e.g. L"[u]"). It only happens when you change the RunProperties (SetRUnPropertiesForAdd() AND you are replacing (i.e. using  Remove() and InsertText() ) some text that is in the final paragraph of a TextBlock.

 

Bruce

Regarding overlapping Geometry

$
0
0

Hi,

I have encountered one overlapping complex shape boundary in a Microstation file. Is there any MDL or C++ API to remove or heal such overlapping boundaries?

Please find the attachements of overlapping geometry for reference.

Regards,

Sowmya

Microstation V8i

$
0
0

Hi,

How to delete and create tagset in Microstation V8i using c.

Regards,

Saravanan

[CONNECT C#] Command Table

$
0
0

When I create a command table in a .NET project (e.g. Commands.xml), the project builds OK but MicroStation doesn't see my command table.

If I edit the Viz Studio project (*.proj) file manually and add a LogicalName element to the command resource specification then MicroStation is able to see my command table...

<ItemGroup><EmbeddedResource Include="Commands.xml"><SubType>Designer</SubType><!-- LogicalName name may be missing --><LogicalName>CommandTable.xml</LogicalName></EmbeddedResource></ItemGroup>

Have I reached the right solution?  I can't find anything about this in the help documents.

[CE5 C#] DgnPrimitiveTool with WPF

$
0
0

I saw some examples of how to apply Form into DgnPrimitiveTool, but I saw nothing about WPF together with DgnPrimitiveTool.

Are there any examples of merging DgnPrimitiveTool with WPF?

Thanks!

[V8i C#/MDL] Translating StatusInt into something readable.

$
0
0

I wonder if anyone could help please? I've got various unmanaged MDL functions in a C# addin for microstation v8i. The implementation of these is fine and when they work it's great.

Here's some code for background:

[DllImport("stdmdlbltin.dll", CallingConvention = CallingConvention.Cdecl)]
internal static extern long mdlView_saveNamed(IntPtr viewNameP, IntPtr descriptionP, IntPtr viewNameSpace, long view);


See the page from MDL Function guide below for the above function. The function returns a 'StatusInt' which indeed does return an integer/long value. But I don't understand what this is or means.

Could someone either point me to a reference that I can look up these codes or give me a clue as to how I can translate them to something string-like.

I've tried assuming they're pointers and tried these:

Marshal.PtrToStringAnsi(pointer)
Marshal.PtrToStringAuto(pointer)


Any ideas?

mdlView_saveNamed

Function

                

StatusInt      mdlView_saveNamed
(
MSWChar const*      viewNameP ,
MSWChar const*      descriptionP ,
MSWChar const*      viewNameSpace ,
int      view
);

Description

      Save the current settings for one of the view windows to a named view element using the given name and description.

Required Header

    <msview.fdf>

Required Library

    mdlbltin.lib (MicroStation Built-in)

Return Value

TypeDescription
StatusInt SUCCESS if the view element is saved successfully, otherwise MDLERR_BADARG if the view argument is not a valid view number.

Parameters

TypeNameModeDescription
MSWChar const* viewNamePINthe name to be given to the named view element when it is saved.
MSWChar const* descriptionPINthe description to be given to the named view element when it is saved.
MSWChar const* viewNameSpaceINthe name space of the named view element. Using NULL will make this named view available to management by the end user via the save views application. Using a non-null value has the effect of making it a protected named view, which is only accessed by the API.
int viewINthe view number to be saved as a named view element.

Version

    8.0.0

VBA Wrapper Declaration

      Declare Function mdlView_saveNamed Lib "stdmdlbltin.dll" ( ByVal viewNameP As Long , ByVal descriptionP As Long , ByVal viewNameSpace As Long , ByVal view As Long ) As Long 

 

[V8i C# MDL] mdlView_setClipBoundaryElement -168 MDLERR_NOCLIPVOLUME - Help!

$
0
0

Wondering if anyone would be able to help with an issue I have setting the clip volume for a view using mdlView_setClipBoundaryElement.

Here's the implementation:

[DllImport("stdmdlbltin.dll", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr mdlView_setClipBoundaryElement(long viewIndex, ref long elementID);
void DoStuff(long viewIndex){
long element = 2950;
var result = PInvoke.mdlView_setClipBoundaryElement(viewIndex, ref element);
result = PInvoke.mdlView_updateSingle(viewIndex); }

The result here is -168 MDLERR_NOCLIPVOLUME

Doing the reverse yeilds the ID '2950' as expected:

[DllImport("stdmdlbltin.dll", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr mdlView_getClipBoundaryElement(ref long pElementId, long viewIndex);
void DoStuff(long viewIndex){
long elementId = 0;
var result = mdlView_getClipCoundaryElement(ref elementId, viewIndex); }

I'm stumped. I've tried different elements, shapes, simple solids, all of which work when setting the clip manually in Microstation and all of which return the correct element ID when using the getter above.

Thanks in advance.

Jon


[V8i - VBA ] Dimension with several segments

$
0
0

How can I acess to each dimension indiviadually thru VBA, when we have  one dimension with several segments?

I can only get and change the first segment. I've tried to implement drop method, but it doesn't behave like "drop dimension to segments" command...

Regards

[CE5 NET API] Import Model from non-active dgn file

$
0
0

Hi,

I want to import model from dgn file into active design file but I do not know where to start.

thanks

Nenad

[CE5 c#] using DgnDocument

$
0
0

Hi,

My system is VS 2015, Framework 4.6.1, c#

I am trying to use DgnDocument in order to copy Model from one dgn file to another.

It looks like  function DgnDocument.CreateForLocalFile does not find dgn file.

After executing  line DgnDocument.CreateForLocalFile I checked targetDgnDocument.DocState property and it returns "DoesNotExist"

I do not understand what is wrong.

            bool test = System.IO.File.Exists("C://Temp//Test3d.dgn");

            DgnDocument targetDgnDocument = DgnDocument.CreateForLocalFile("C://Temp//Test3d.dgn");
            DgnDocument.Access access=  targetDgnDocument.AvailableAccess;
            DgnFileOwner dgnFileOwner = DgnFile.Create(targetDgnDocument, DgnFileOpenMode.ReadWrite);
            DgnFile dgnF = dgnFileOwner.DgnFile;
            ModelIndexCollection mic = dgnF.GetModelIndexCollection();
            StatusInt loadDetails;
            ModelId id = dgnF.FindModelIdByName("291114TH_2001");
            DgnModel dgnModel = dgnF.LoadRootModelById(out loadDetails, id);


            //DoSomeWork(dgnModel);

            //dgnFile.ProcessChanges(DgnSaveReason.ApplicationInitiated);
            dgnFileOwner.Dispose();

Appriciate any help

thanks

Nenad

[CONNECT C++] mdlCell_getLibraryObject

$
0
0

The MicroStationAPI help for mdlCell_getLibraryObject...

StatusInt mdlCell_getLibraryObject ( DgnFileP *  ppLibraryObj,
  WCharCP  pLibName,
  bool  unused
 )
Parameters
[out] ppLibraryObj  pointer to the cell library object.
[in] pLibName   name of the cell library to find.
[in] unused   Unused; pass false.

But, in example cellexp.cpp we see...

iStatus = mdlCell_getLibraryObject (&pLibObj, activeCellLibraryName.c_str(),true);

What value should we assign to that last unused parameter?

[CE5 C++] MS_PAGALLOC

$
0
0

Hello,

I launch MicroStation CONNECT updt5  from a bat  file setting MS_PAGALLOC=1 and I obtain the alert Window joined.

( My operating system is W7 SP1 64Bit and Microsoft Visual c++ 2015 Redistributable (x64) -v 14.0.2.4112 is installed. I haven't such message with MicroStation CONNECT updt 3 or MicroStation V8i.)

Any idea?

Best regards,

Patrice

[CE5 NET API C#] How to active existing Model

$
0
0

Hi,

How do I activate existing DgnModel using NET API c# ?

thanks

Nenad

mdlRegion_floodFillWithHoles broken in Connect?

$
0
0
mdlRegion_floodFillWithHoles seems to be broken in Connect, at least through the managed interfaces. I've tried calling it with the following definition that works fine in V8I using the exact same dataset. The result is MDLERR_NULLSOLUTION.
Slumming it in VBA and using the GetFloodBoundary function also fails with the same error code so it seems something is generally broken. Again, this works fine in v8i and the code is I believe correctly written to work on both 32 bit and 64 bit environments.
Other functions I've written this way work fine in 64 bit so this function seems to be an outlier.
A code snipped of the calling method is as follows:
foreach (var e in boundaryElems)
{
 IntPtr elemDescrP = new IntPtr(e.MdlElementDescrP(true));
 CSMDL.mdlElmdscr_initOrAddToChain(out elemChainP, elemDescrP);
}
int viewIndex = 1;
IntPtr templateP = (IntPtr)templateElem.MdlElementDescrP(true);
IntPtr modelRefP = (IntPtr)MSA.ActiveModelReference.MdlModelRefP();
IntPtr floodP;
double area;
// Get coordinates into an array;
double[] seedPtv = new double[3] { seedPoint.X, seedPoint.Y, seedPoint.Z };
                   
unsafe {
 fixed (double *seedP = seedPtv)
 {
  var result = CSMDL.mdlRegion_floodFillWithHoles(out floodP, out area, elemChainP, templateP, modelRefP, (IntPtr)seedP, viewIndex, 0, 0.0, 0);
    // returns MDLERR_NULLSOLUTION
 }
}
Any ideas? I'd be willing to rewrite this using the MstnPlatformNET SDK if someone could point me towards the namespace or functions that would assist this task, since the documentation is nonexistent.

[C++ SDK Engineer Content] 'Locked' property always return true/locked

$
0
0

Hi Experts,

I am using the Microstation C++ sdk to query model's engineer contents, one issue I notice is the 'Locked' property always return true/locked even I saw the element is `unlocked` in microstation application, please see the image:

And here is the code I used to query out all ECInstasnce properites:

	DgnFilePtr dgnFile = OpenDgnFile(filename, DgnFileOpenMode::ReadOnly);
    DgnModelR dgnModel = GetDefaultModel(*dgnFile);
    DgnECManagerR dgnECManager = DgnECManager::GetManager();

    // Whenever we query for instances, we need to supply a "scope" for the query...
    // Do we want to query in just one model, or in a model plus all of its attachments?
    bool includeReferenceAttachments = true;
    FindInstancesScopePtr scope = FindInstancesScope::CreateScope(*(dgnFile.get()), FindInstancesScopeOption(DgnECHostType_FileAll, includeReferenceAttachments));

    /////////////////////////////////////////////////////////////////////////////
    // First, we "Find all ECInstances in this model (and its referenced models)"
    ECQueryPtr  findAll = ECQuery::CreateQuery(ECQUERY_PROCESS_SearchAllClasses); // Finds ALL ECInstances, regardless of their ECClass

    for each (DgnECInstancePtr instance in dgnECManager.FindInstances(*scope, *findAll))
    {
		DgnElementECInstancePtr elementInstance = instance.GetAsElementInstance();
		if (elementInstance.IsValid())
		{
			ECClassCR elementClass = elementInstance->GetAsElementInstance()->GetClass();
			ECPropertyIterable iter = elementClass.GetProperties();


			ECPropertyIterable::const_iterator cit = iter.begin();
			while (cit != iter.end())
			{
				ECPropertyP p = *cit;

				ECValue v;
				if (SUCCESS == pIECInstance->GetValue(v, p->GetName().c_str()))
				{
					wprintf(L"\n    Property name =%ls", p->GetName().c_str());
					if (v.IsBoolean()) // print out property name and it's values.
					{
						wprintf(L" value=%d, ", v.GetBoolean());
					}
					// else if () other types.
				}
			}
		}
    }

And here is the model I used for testing.

(Please visit the site to view this file)

Could you please help take a look? 

Thanks

Danny

[CONNECT C++] Can we catch a V7 to V8 file upgrade before Microstation converts the file?

$
0
0

When a user opens a V7 file, a Microstation popup is presented that asks the user if they want to "upgrade" to V8 or open the file as V7 ReadOnly. At this point, Microstation has not yet "converted" the file to V8. Is there  any way, in code, to "trap" that event? I want to have the user respond to a DialogBox that I hope to display PRIOR to the actual file being converted. Depending on the answer(s), I would either allow the conversion to take place or deny the file upgrade, and open in V7 ReadOnly format.

Bruce

[CONNECT C++] TextBlocks and Carets in a mixed font piece of text

$
0
0

Given a piece of text that uses more than one  font usage (e.g. "Note", where the "No" and "te" use different fonts), when you use FindText() to locate that string ("Note"), FindText() does not worry about what font was used. When FindText() returns a match, I create a RunRange() using the MatchStart and MatchEnd carets. For that RunRange, I then use a RunIterator to create get each "part" ( runIter.ToCaret()->GetCurrentRunCP() ).

Now I've got (in my example) two "runs". First is "No" and the second is "te". If I wish to replace "No" with "To" (i.e. go from "Note" to "Tote"), TextBlock->ReplaceText() needs a start and end Caret. The Carets returned by FindText() represent the entire "found" text, NOT the individual "run" parts. How can I get Carets that represent the start and end of the "run" (e.g. ONLY the "No") that comes from the RunIterator? Is it possible ? I think the Carets returned by RunRange.GetStartCaret() and GetEndCaret() are simply the ones used to create the RunRange.

Bruce

Native code attach to process debugging

$
0
0

In the Wiki for debugging native code mdl application it mentions being able to attach to the microstation process and then select the dll to debug as follows:

Debugging the Application

Once connected to the MicroStation process, you can add the application to debug. The first step is to include the application's DLL. Select Project > Settings, and select the Debug tab. Change the Category option to Additional DLLs. Select the application's DLL and click OK.

I cannot find where this option to select the additional DLL in Visual studio 2013 is.

Ray

Code Syntax Highlighting

$
0
0

The new code blocks have support for syntax highlighting. Any chance at getting IPlot Design Script as a language? Also might be neat to get MicroStation configuration file variables as a language too.

Viewing all 4331 articles
Browse latest View live


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