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

OS Could not load .dll, error 126.

$
0
0

Hello,

I have a custom add-in for Microstation Select Series 4. I had this .dll working before in my older dev machine. Then, I upgraded to SS10 and I was still able to run my custom add-in. However, I got a brand new machine. Proceeded to do a clean install of SS10 but I get the following error when launching my command. I wonder since it s a bran new machine, if there are any settings I missed during the installation. It seems odd to me that the same installer for my custom plug in failed in a clean environment. Any thoughts would be appreciated.

Thanks in advance,

Caleb


Timer() Code failure

$
0
0

I have read a lot of questions, I have also taken advice on the Goggle the question and spent hours trying to get a simple timer

I tried using the Timer() feature but Debug does not like what I have . I called myself copying it correct I had even tried making a Dim Timer just in case.

Will anyone help me figure this out? Please See below tried to paste in the error message received and I read the help on it but still do not know what is wrong

Type mismatch (Error 13) 

is where is read?

Sub PauseCodeOld1()
Dim Start As Single ' Snapshot of when timer started
Dim Elapsed As Single ' Total time elapsed
Dim Pausetime As Single ' Desired duration in seconds
Dim TimerTemp As Single ' store current value of Timer function
Dim Timer() As Single ' Added trying to stop the Subscript out of range (Error9)
' modified to as Single 081619
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
Pausetime = 5 ' Set duration.
'MsgBox ("Time Now " & Results)

' Store current Timer value
' Timer is a VBA function that Returns a Single representing
' the number of seconds elapsed since midnight.
Start = Timer()

Do ' Begin a Do While Loop
DoEvents ' Yield to other processes and waste time.

' Calculate elapsed time
' Get current value of Timer function
TimerTemp = Timer
' Calculate how many seconds have elapsed between now and Start
Elapsed = TimerTemp - Start
Debug.Print "Elapsed: " & CStr(Elapsed)

' Determine if the Elapsed time is greater than desired pause time
' If not, then repeat loop
Loop While Elapsed <= Pausetime

MsgBox "Paused for " & CStr(Elapsed) & " seconds"
End If
End Sub

This was the error, not sure if you can ready what is says Compile Error: Type Mismatch

[CONNECT VBA] Projects loaded before file is opened

$
0
0

Hi,

It seems that MicroStation loads the VBA project connected to the last WorkSet loaded even before any file is opened.

I have a VBA project in WorkSet A that hooks into file open/close events. When I start CONNECT, it remembers the last WorkSpace/WorkSet that was used (in this case WorkSet A) and it is pre-selected in the backstage. If I select some other WorkSpace/WorkSet and open a file the code connected to the file open/close event from WorkSet A is still executed.

This makes it impossible to switch between different WorkSpaces/WorkSets that has VBA-code containing event hooks.

Regards,

Krister

Microstation CONNECT; mdl; text node element

$
0
0

Hi,

I have tried every possible method in Microstation API to extract text from TextBlock created from a text node element, but all I get is a empty string.   I looked at the example code in Microstation API help under mdlTextNode_extract.

ElementHandle eh (...);
TextBlockPtr textBlock = TextHandlerBase::GetFirstTextPartValue (eh);
WString string = textBlock->ToString ();
The string above is empty!!!!
I also tried the following methods:
caret->GetCurrentRunCP()
caret->MoveToNextCharacter,()
caret->MoveToNextParagraph ()
caret->MoveToNextField()
but I still can't get the text string in a text node. Can someone tell me how to extract text string from a text node.
There should be more documentation on TextBlock.  It is difficult to understand the various components of a text block like TextBlockProperties, TextField, ParaGraphProperties, RunProperties, etc.

Thanks.

[CE U12] Polyface in C#

$
0
0

Hi all,

I see that in C++ I could extract info like polyface vertex/index arrays in this way:

status = mdlMesh_getPolyfaceArraysExt(inEdP1, &pArrays0, &pNumPerFace0, NULL, NULL, NULL, NULL, NULL, false);

mdlPop_polyBrepFromElementDescrEx(&pBrep0, pContext, &pArrays0, pNumPerFace0, &color0, false, false);

Is there a C# counterpart for this operation?

I wasn't able to find it.

Thanks.

MicroStation CE SDK Update 13 available for download

$
0
0

Hi all,

because I know is out of office this week, so it's not easy for him to update the blog posted last week, I'd like to point out that Update 13 SDK is available for download from yesterday :-)

With regards,

  Jan

[CONNECT C++] DgnElementSetTool and Picking 2 Elements

$
0
0

I know I've asked about this a few times in the past, but I still seem unable to write my DgnElementSetTool to react the way I want. I'd like my tool to operate (i.e. select elements) the same way as the "Trim to Intersection" tool: Datapoint 1 identifies a line, then Datapoint 2 identifies the other line AND immediately processes the 2 picked elements to find the intersection and "trim" the lines. In my tool, I have:

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

private: virtual	size_t     _GetAdditionalLocateNumRequired()                  override { return 2; }
private: virtual	bool       _WantAdditionalLocate(DgnButtonEventCP ev)         override { return WantAdditionalLocateHelper(ev); }
private: virtual	bool       _OnModifierKeyTransition(bool wentDown, int key)   override { return OnModifierKeyTransitionHelper(wentDown, key); }

private: virtual	StatusInt	_OnElementModify(EditElementHandleR eeh) override
{
	if (GetElementAgenda().size() < _GetAdditionalLocateNumRequired() )
		return ERROR;
    ...
}    

but I must then use two CTRL-Datapoints to pick the first and second element THEN a third Datapoint to cause the tool to fire _OnElementModify(). When I look at the Trim to Intersection tool, the first Datapoint picks (and hilites) the element, then the second Datapoint picks the other element AND immediately processes the operation with no additional Datapoint for acceptance required. I'd like to reproduce that workflow.

[CE U13 SDK] Missing slash in winntmdl.mki => fatal error LNK1181

$
0
0

Hello SDK - Team,

Also in U13 I am missing a slash in winntmdl.mki. It causes:

LINK : fatal error LNK1181: file "C:\PROGRA~2\MIB055~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270lib\x64\msvcrt.lib"

Line 545 – 548 in winntmdl.mki

			ntLib           =       ${ntTools}lib/x86/
			AsmCmd          =       ${nttools}bin\HostX86\x86\ml
		%else
			ntLib           =       ${ntTools}lib/x64/

the {} causes to remove the last slash. I would expected something like this:

			ntLib           =       ${ntTools}/lib/x86/
			AsmCmd          =       ${nttools}/bin\HostX86\x86\ml
		%else
			ntLib           =       ${ntTools}/lib/x64/

See also: [CE SDK U12] Define ntLib in winntmdl.mki Line 543ff causes fatal error LNK1181

Thanks a lot


[CONNECT C#] How to filter geometry in a reference by Named Group

$
0
0

Hello all

I need the abilty to filter geometry from an attachment reference using preconfigured Named Group (like the options "Named Group" inside the Attachments Properties)

Actually I create attachment programmatically using Bentley.DgnPlatformNET namespace

Is there a way?

Thanks in advance

[CE U13 SDK] Errors in the bat-files for Developer Shell

$
0
0

Hello SDK-Team,

I mention this to  concerning U12 – SDK, but these errors are still in the SDK. Of course, these errors will not affect the building process. There are some good ideas inside to customize the developer shell, but none of them work, and some disturbed our building process, because there is no working possibility to switch them off.

Here are my patches, these may not be the best ones, but at least they work. ;-)

  1. MicroStationDeveloperShell.bat:
    Line 32: “if defined _SDKDISPTIPS echo…” => “if %_SDKDISPTIPS% NEQ 0 echo…
  2. SDKCommonEnv.bat:
    Line 87: “if _SDKINITVS NEQ 0 call…” => “if %_SDKINITVS% NEQ 0 call…

How to reload attachment using C#

$
0
0

Does anybody know how to implement the Reload function using C# for Connect Edition, just like the context command below

[CONNECT C#] DgnElementSetTool set locate to only allow specific reference?

$
0
0

trying to figure out how to set up SetLocateCriteria to only allow selection of elements from a certain reference. 

i want the user to select an element from a particular reference and then get some info on what was selected (so only allow selection .

following other posts i have set IsModifyOriginal to return false and OnElementModify to return error.

here is the code i have started with...not much

    public class selectRefElement2 : DgnElementSetTool
    {

        protected override bool IsModifyOriginal()  {return false;}

        protected override void SetLocateCriteria()
        {
            
        }

        public override StatusInt OnPreElementModify(BD.Elements.Element Element) {return StatusInt.Success;}

        public override StatusInt OnElementModify(BD.Elements.Element element)
        {
            return StatusInt.Error;
        }

        protected override void OnRestartTool()
        {
            throw new NotImplementedException();
        }
    }

just not really finding anything out there for examples with  SetLocateCirteria.

 any hints..

[CONNECT C++, .NET, VBA] Can a Picklist have a Description?

$
0
0

It would be useful, when managing Picklists, for a Picklist to have a description as well as a name.

For example, a Picklist named "Door Furniture" might be described "Assign this Picklist to Item TypeDoor.Fittings."

VBA PropertyHandler SetValue method

$
0
0

Hello everybody!

AECOsim v8i ss6

ver. 08.11.09.866

When i create a SvedView from active view(1) the size of SavedView borders is equal to view(1) window size as it is.

So, after creating i need to change its borders, because i dont need some objects in drawing.

I want to change Extents.X for example.

What i exactly try:

Dim ele As SavedViewElement
    Dim oPH As PropertyHandler
       Set ele = ActiveDesignFile.FindSavedView("test_view")
       Set oPH = CreatePropertyHandler(ele)
       oPH.SelectByAccessString ("Extents.X")
       oPH.setValue "650"

I suppose mistake is in property names or syntax...

Could you advice how it should be?

[CE U13 C#] Bug? Element selected but not highlighted

$
0
0

Hi experts,

I have a DgnFile linked to other DgnFiles.

I'm trying to programmatically select an item inside a referenced Dgnfile.

It seems that the element is selected (I can see it in “Selection Set number of elements”), but visually the element is not highlighted.

Even if I try to manually force the Hilite on that element, nothing happens.

The same procedure works perfectly on the elements in the main DgnFile.

Here some example code:

class ElementHighlighter : IDisposable
    {
        ElementAgenda elementAgenda_;
        ElementAgendaDisplayable elementAgendaDisplayable_;

        DgnModelRef _dgnModelRef;
        public void SetDgnModel(DgnModelRef dgnModelRef)
        {
            _dgnModelRef = dgnModelRef;
        }

        public enum HighlightCriteria
        {
            SingleHighlight,
            MultipleHighlight,
        };
        private HighlightCriteria highlightCriteria_;

        public ElementHighlighter()
        {
            elementAgenda_ = new ElementAgenda();
            elementAgendaDisplayable_ = new ElementAgendaDisplayable();

            SelectionSetManager.BuildAgenda(ref elementAgenda_);
            highlightCriteria_ = HighlightCriteria.SingleHighlight;
        }
       
        public HighlightCriteria Criteria { get { return highlightCriteria_; } set { highlightCriteria_ = value; } }

        public void Empty()
        {
            SelectionSetManager.EmptyAll();
            elementAgendaDisplayable_.ClearHilite();
            elementAgendaDisplayable_.Empty(true);
        }
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (elementAgenda_ != null)
                {
                    Empty();
                    elementAgenda_.Dispose();
                }
            }
        }

        /// Add an element to our agenda.
        public void AddElement(Bentley.DgnPlatformNET.Elements.Element el)
        {
            if (HighlightCriteria.SingleHighlight == highlightCriteria_)
            {
                Empty();
            }

            var dgnModelref = _dgnModelRef;
            if (dgnModelref is null)
                dgnModelref = el.DgnModelRef;

            var status = SelectionSetManager.AddElement(el, dgnModelref);

            var isActive = SelectionSetManager.IsActive();
            var status2 = SelectionSetManager.ReplaceWithElement(el, dgnModelref);
        }

        /// Remove an element from our agenda so that it is no longer highlighted.
        public void RemoveElement(Bentley.DgnPlatformNET.Elements.Element el)
        {
            el.Invalidate();

            var dgnModelref = _dgnModelRef;
            if (dgnModelref is null)
                dgnModelref = el.DgnModelRef;

            SelectionSetManager.RemoveElement(el, dgnModelref);

        }
    }

Thanks!


[CONNECT Update 12 C++] Which version of MicroStation connect is more stable?

$
0
0

We currently use v.12 but we experienced crashing problems with pointers. Someone suggested that we downgrade to v.10, is it more stable?

[V8i] Finding Lines of a particular style that have an endpoint at a particular point

$
0
0

What is a good way to go about finding out whether the endpoints of a line are coincident with a particular point?

I am not sure whether the context is important but will describe it and then get to the point:

Broadly, I have a layout with two different types of nodes. Call them LV nodes and Houses. The idea is to draw lines between them which would be electrical service connections. A node can connect to multiple houses but a house can only connect to a single node. Each node can have X number of service connections and the length of each connection should be as short as possible(within reason). 

The current philosophy is to use ElementScanCriteria to find all of the nodes and houses and then to loop through all of the nodes one at a time and find the closest X Houses. Then it would, one at a time check through each house to see if it has been connected or not(*** This is where the difficulty is ***). Once it has found out whether the house is connected or not, it checks to see whether the existing connection (if there is one) is longer than the possible new one and if it is, the existing connection is deleted and a new one is made.

The current function I am working on is "Existing Connection" and is to return a True or False based on whether a house is connected or not. The function takes in a point and then checks whether there is an endpoint of a particular line style at the target point. I am not sure whether I am using the ElementScanCriteria properly or if there is just flat out a better way of doing it. 

Function ExistingConnection(TargetPoint As Point3d) As Boolean

Dim oScanCriteria As ElementScanCriteria
Dim oScanEnumerator As ElementEnumerator
Dim oElement As Element

ExistingConnection = False

Set oScanCriteria = New ElementScanCriteria

oScanCriteria.ExcludeNonGraphical
oScanCriteria.ExcludeAllTypes
oScanCriteria.IncludeType (msdElementTypeLine)
oScanCriteria.IncludeLineStyle ActiveDesignFile.LineStyles("CustomLineStyle")

Set oScanEnumerator = ActiveModelReference.Scan(oScanCriteria)

Do While oScanEnumerator.MoveNext
    Set oElement = oScanEnumerator.Current
    If oElement.AsLineElement.EndPoint.X - TargetPoint.X = 0 Then
        If oElement.AsLineElement.EndPoint.Y - TargetPoint.Y = 0 Then
            If oElement.AsLineElement.EndPoint.Z - TargetPoint.Z = 0 Then
                ExistingConnection = True
            End If
        End If
    End If
Loop

End Function

Sometimes the function appears to work and other times, not. It is consistent about the results if I use a particular house as target point, it will either always give true when connected or always give false if connected which leads me to think that it might be the scan criteria that need to be better defined.

[CONNECT C++] How to Obtain the Vertices of a LineString at a given Location (Fraction)?

$
0
0

If I have a LineString (as a CurveVectorPtr) and some point on that LineString, I can retrieve the direction (i.e. Tangent) at that specific location. If I have a CurveLocationDetail, I also know the index of the segment that some point lies on. How can I obtain the LineString vertices that "enclose" that  point? If the LineString contain 3 "segments" (i.e. has 4 vertices) and my point lies on "segment" index 1 (between vertice[1] and vertice[2]). how can I return the DPoint3d of vertice[1] and vertice[2]?

Thanks

Bruce

Oracle Linkage

$
0
0

Can any one help me ,how do i extract Oracle Linkage in Microstation V8(Version 8)?

How to get the rang of a element or element's coordinate with C# for Microstation CE 10.0.7?

$
0
0

Hi Experts,

 I need to get the selected element(the first selected one) range box or just a point from that element,

i have below code(C#) to get a selected element,

            Bentley.DgnPlatformNET.Elements.Element element = null;
            DgnModelRef model=null;
            SelectionSetManager.GetElement(0, ref element, ref model);

my question is how i can get the range of that element, or a point from that element? i am runing with C# code.

thanks,

Rick

Viewing all 4331 articles
Browse latest View live


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