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

Create Conic Curve Element?

$
0
0

Hi all, 

I'm new to VBA coding in Microstation and currently trying to create a parabola in microstation based on an array of coordinates in excel. 

The coordinates reflect the Conic Curve (Parabola) tool in Microstation taking the start, end and shoulder points

From my understanding, the only way to create curve elements using VBA is to create a BSpline Curve. However the shoulder point on the Bspline curve is located far below that of the shoulder point generated from the Conic Curve Microstation tool. 

Is there a way to create a Conic Curve element from the BSpline objects in VBA or is there another way to do this?

This is my code currently that generates the BSpline Curve.

Dim StartPtX As Double
Dim StartPtY As Double
Dim EndPtX As Double
Dim EndPtY As Double
Dim ShoulderPtX As Double
Dim ShoulderPtY As Double
Dim StartPtDGN As Point3d
Dim EndPtDGN As Point3d
Dim ShoulderPtDGN As Point3d

StartPtX = Sheets("Coordinates").Cells(19, 2)
StartPtY = Sheets("Coordinates").Cells(19, 3)
StartPtDGN = o.Point3dFromXY(StartPtX, StartPtY)

EndPtX = Sheets("Coordinates").Cells(20, 2)
EndPtY = Sheets("Coordinates").Cells(20, 3)
EndPtDGN = o.Point3dFromXY(EndPtX, EndPtY)

ShoulderPtX = Sheets("Coordinates").Cells(20, 8)
ShoulderPtY = Sheets("coordinates").Cells(20, 9)
ShoulderPtDGN = o.Point3dFromXY(ShoulderPtX, ShoulderPtY)

Dim Curve As New BsplineCurve
Dim CurveE As Element
Dim pts() As Point3d

ReDim pts(0 To 2)
pts(0) = StartPtDGN
pts(1) = ShoulderPtDGN
pts(2) = EndPtDGN
Curve.SetPoles pts
Set CurveE = o.CreateBsplineCurveElement1(Nothing, Curve)
CurveE.Color = 3: ActiveModelReference.AddElement CurveE

Kind regards,


[V8i MDL] Changing Workspace within MicroStation

$
0
0

Does anybody know if there anyway of changing the active workspace once you're in MicroStation ?

I've got an old initapps application that has replaced the standard MicroStation front end and a user has asked if it's possible to select a ucf or a pcf from within it.

I can see that mdlSystem_getWorkspaceList() can be used to get a list of available workspaces but can't see anyway that could then be used, or if the workspace can be changed once MicroStation is up and running.

[Connect C++\C#] mdlUndo_startGroup \ mdlUndo_endGroup does not seem to be working in Connect. Is there an alternative?

$
0
0

I am plotting a bunch of elements in groups. I am calling startGroup and endGroup after each group, however, when I undo the last command, they all disappear.

Is there another way to accomplish this?

System fault 3

$
0
0

Hi,

I got system fault 3 error and application crashes. Kindly help to resolve the problem.

Regards,

Saravanan.

Spreadsheet text into dgn v8

$
0
0

Hi

I have some drawing-specific texts listed in excel column.
Is it possible to create a vba that match the dgn filename (listed in one column) 
and then insert text in same row from text-column?

alternatively: the vba can run down the text-column in a batch process without checking filename.
(User must then make sure that the batch process runs in same order as excel columns)  

Know any tools for microstation that deals with something like this?

Any help on this would be great.

Link a tool to Micorstation

$
0
0

I have created a basic tool to edit text case in visual basic. I need to be able to hook into microstation and be able to read what is being displayed on the .dgn to do this.

I have been told that an API help in this?

How can I Set active Feature Cell Parameter set name with VBA - is there another parameter to MODELER CELL PLACE

$
0
0

In MicroSation V8.11 VBA I want to use a keyin to place a parametric solid based on a parameter set name generated by the VBA user-interface.

I can activate the command and the appropriate feature solid using the command keyin

MODELER CELL PLACE <name>

where name is the cell name.

MicroStation documentation does not indicate that <name> is a parameter that can be used with the command, so I wonder if there are more parameters to the keyin command and if not, how can I change the Place Feature Cell tool setting for "Params" to the text string generated in the VBA GUI.

Triangulated shape element.

$
0
0

I use Microstation V8 (2004 edition V 08.05.02.35) and programming in MDL.
How to triangulated shape element in this version Microstation.

In Microstation V8i are available functions:
mdlMesh_newPolyfaceFromXYTriangulation (...);
mdlMesh_convertToShapes (...);

How to make in older version Microstation?

Regards.


[Connect C++] How to Get Property Category information

$
0
0

Hi Expert:

I am reading DGN model's property using DgnElementECInstancePtr->GetValue(ECValue& v, const wchar_t* pName), I can read out these properities of below images already, do you know how can I get the category information as well? 

Right now I use following codes to read categories:

    ECPropertyP p = ...;

    // EditorCustomAttributes:Category is standard Microstation EC schema and used as the category when showing in UI.
    // The `DisplayLabel` corresponding value is the category name.
    IECInstancePtr customAttributeCategory = p->GetCustomAttribute(L"Category");
    if (customAttributeCategory.IsValid())
    {
        // Check is the NullFlags for the Null setting of a specific value without read the actual value
        bool isNull = false;
        ECObjectsStatus returnvalue = customAttributeCategory->IsPropertyNull(isNull, L"DisplayLabel");
        if (SUCCESS == returnvalue && !isNull)
        {
            ECValue customValue;
            if (ECOBJECTS_STATUS_Success == customAttributeCategory->GetValue(customValue, L"DisplayLabel"))
            {
                if (customValue.IsString())
                {
                    category = customValue.GetString();
                    return true;
                }
            }
        }
    }

And it seems the category isn't always correct for example:

Do you have any suggestions how to read the Microstation displayed property categories?

Compiling MDL and determining what files are used

$
0
0

I'm back with more questions!!!

Just to recap, back into the MicroStation world with very limited MDL experience and trying to determine what files I need to keep and subsequently put into our source code database.

So I created a blank folder structure and started with my app.mc and app.mke and ran the compile, adding files back as the compiler identified missing files. I finally got all the files the compiler asked for and the app compiled.

Is it safe to assume that that is all the files I need?

Thanks for any help!!

[CONNECT C++] Possible to somehow make a "nested cell" given two EditElementHandles ?

$
0
0

Is there a way to create a "nested" cell when you have two EditElementHandles, when each is a handle to a cell? Is it wise to create a new cell header then use mdlElmdescr_appendDscr() to add in the ElementDescr's from each EditElementHandle? IS there another way?

Thanks

Bruce

[CONNECT C#] How to get path to addin (dll)?

$
0
0

Hello!

Is there method to get dll path in .Net?

Actually, my addin (dll) should look for some folder next to itself. Is it possible to define path relative to dll?

Thanks.

Denis

How Bentley are shooting into their own leg

$
0
0

I spent some time thinking whether to write a reaction to older discussions) about MicroStation SDK availability and recent steps leading to closing of “a world of MicroStation programming”. Originally, I thought about “What is Bentley long term strategy for 3rd party developers” theme, but at the end it seems to be the tangle of problems / issues that is not easy to describe. So, I use this slightly more general and provocative subject and try to express my feelings.

At first, a disclaimer: This post represents my subjective opinion and is based mostly on my experiences (small and mid, typically engineering but also utility, companies) from Czech Republic, and partially also what I heard from my friend from other European countries. Maybe my arguments are not valid for long term complex projects delivered to big asset operators in telco or power distribution and less fragmented markets (European Union represents one from 3 biggest economies in the world but comparing to US and China it’s fragmented to many local markets).

At second, I’d like to apologize for lengthy text.

And at third, I also probably should apologize for black and white and maybe too strict evaluation. I guess a combination of winter depression with a contradiction between MicroStation CONNECT Edition with rich (even no too much documented) API and steps against people who like to use this API. On the other hand I will repeat what other people wrote in other discussions already: Limiting access to SDK and API is another bad Bentley decisions complicating using Bentley products.

Ok, let’s return to my original question: “What is Bentley strategy for 3rd part developers and related ecosystem formed by any extensions from simple macros to complex applications?” I assume there will be an answer like “We have (great) BDN program and we carefully listen and take care about 3rd developers”, but despite of it sounds nice, this is far from reality. And BDN itself is not my focus (I appreciate information provided by Bob, Arthur and YonganFu), because it’s about the development in general.

For many years Bentley have closed MicroStation programming and limiting the access to it step by step. I remember all tools (MDL) were delivered with MicroStation automatically. Later the separate SDK was created, but still accessible to everybody. And last year, it was closed to BDN members only. No information about such change, no information about how to start with development available on web (“ask us” / “fill form” is not information but annoying obstruction).

If I compare it with other solutions, both commercial (AutoCAD, Revit, ArcGIS, Allplan, ArchiCAD…) and open-source l(PostgreSQL + PostGIS, GeoServer, Open Layers): Do you want to develop anything? Download it, it’s simple, just click “Download” button, typically even registration is not required (and when it’s required like in ArchiCAD case, the whole process and requirements are clearly, without marketing fuzzy formulations, described). The route between idea / requirements to dev tools installed and start coding is straightforward and fast.

In my opinion Bentley also failed in teaching developers and motivating new ones. This applies both to the area of education (schools and universities) and existing users. Bentley has close to zero presence in (Czech) schools and I know about plenty of people stopped to try to teach MicroStation or other products simply because it’s so complicated and costly and Bentley don’t care to support them. Especially when compared with so many events, educational programs (often created in Czech language) and competitions organized by local offices, local partners (when no company has office) or local communities sponsored by the company.

And when somebody (a student because of seminary work or dissertation, current user because of company internal requirement or just for joy or manager looking for solution of specific problem) need to develop anything: No chance. Even for existing SELECT users, as was mentioned already in some discussion, to extend agreement to BDN SELECT is not acceptable, because it’s slow (does not allow to start immediately) and requires legal acts (which is tough process often).

What about consequences? As Stuart wrote in the mentioned discussion, he lost his enthusiasm for Bentley products and has resigned to a role of “MicroStation advocate”. What I have seen for last several years at different conferences and talking with customers, is even worse:  Bentley, MicroStation or other products are less and less presented there or discussed as the used tools. Bentley products are dismissing from market.

For me long term business strategy is like a table with more legs. When all are durable, and suddenly some breaks, it’s not an emergency. But when more legs are weak, the sensitivity is higher, and stability is low. Using this picture, many table legs are rotten I guess, but moreover the legs related to programming were effectively severed by Bentley itself.

One from “removed leg” is about how to fulfill local specifics and requirements. I assume all software companies are persuaded their software is genius piece and will solve anything and everything. Nothing can be more distant from everyday reality in any project: There are so many local rules, country or industry standards or even company specific procedures that no software is able to handle them all well.

When the software allows to be extended / customized and at the same time there are people capable to do it, the problem is solved. The first condition is solved, MicroStation-based (but also ProjectWise and other software) provides rich API. Great! But … there are lack of people. Bentley are responsible that there are no new ones and if anybody is interested in CAD development, he will probably choose other platform (even simple tasks like preliminary study whether API supports a feature cannot be done, because contrary the others, nothing is available publicly). Bang, first leg crashed and removed.

Because there are no individual and internal developers (of course commercial developers exist), no tools exist. I assume many users will agree there were quite a lot MDL apps available in time of MicroStation 95 or J. Many from them were simple and developed by individual in their spare time, but they were valuable. Today? Just a few. Even Bentley have not been able to migrate own tools available for free (tool library) to CONNECT Edition. The situation is worse because there is no “application central point”. Compare it with other platforms, where plenty of macros, tools, applications are available, often for free and available in different lists. I remember many situations when in community or at conferences some problem was discussed (data import, drawing output generation…) and somebody told “I developed own macro and can share it with you”. No chance for MicroStation. Crack, second leg broken.

Unfortunately, it’s even worse. In Europe Bentley have ignored INSPIRE for many years (for people don’t familiar with INSPIRE, it’s EU directive aiming environmental spatial data, mandatory for all EU countries and all subjects anyhow related to environment and nature protection like utilities, network operators, of course government and cadaster etc.). One from results is that INPISRE data must be published, so they are available to people, usually in OGC formats (Open Geospatial Consortium) like GML or WFS (I think sometimes local formats are used also). After 10 years of existence of INSPIRE, Bentley products are not able to handle these data at all (e.g. WMS-T or WFS in MicroStation) or had reported but not corrected problems (WFS in Bentley Map). What competitors? For last few years, at least in Czech Republic, the problem is solved. Quite often through local developers and in some cases the local solution was good enough that international company don’t develop own one (which I think is great example of possible synergy, where local developers solve the problem how to “act locally”).

Because environmental data is part of literally every engineering project, inaccessibility of INSPIRE data is competitive disadvantage and I know several companies that migrated (or are in such process) from Bentley platform, because to don’t be able to access all necessary data easily is more expensive than the migration itself.  Now, very loud crash, another leg broken.

The last consequence relates to the development itself: Because there are no students with MicroStation knowledge, and how to develop application skills are quite low between users (because there are no good resources and it’s impossible to access even API description), the development is more expensive than a development to other platforms. To hire new MicroStation developer means to find general developer and to teach him MicroStation and API. It requires at least a half of the year to work independently and after one year he will be come productive. As I wrote, expensive. To find somebody with e.g. AutoCAD, Sketchup or whatever else knowledge who has at least basic experience with development (e.g. he tried to create a macro as student or as employee) is substantial easier. So, this is 4th leg broken.

Is there any “final question” or conclusion? I am not sure, probably not. It was just about to express my feeling that things get worse and that to have technically above average product is not enough and there are areas where competitors are far more active, open and friendly, which possibly will help them to win in future. History is full of such examples: Microsoft won with Windows over OS2 and other OSs because at this time great VisualC and availability of other dev tools from Borland, recently he failed with Window Phone because bumbling API and developer support. And so many open-source projects survived early stages not because of its their quality, but because of great community providing support, learning materials and documentation, so other developers were interested in to commit and use it.

But maybe it would be enough to only clearly describe on web what Bentley strategy and priorities are and that Bentley decision is to provide access to any API under BDN agreement and for anybody else only VBA is available. But I don’t find any such information.

With regards, a bit depressed,

  Jan

Draw perpendicular line from nearest located element to a known point

$
0
0

Hi all,

I want to write a VBA macro which will allow me to draw a perpendicular line from the nearest located element (located from the known point) to a known point. 
Illustration below

Here are my questions
1. How do I locate the nearest element based on the known point?
2. How do I generate a line element perpendicular from the located element to the known point?

Thanks for the help in advance.

V8i MDL - can't see change I made in compiled MDL

$
0
0

I'm back again

I made 2 small changes to an .mc file to re-title a Save As dialog box and change the file filter type. I recompiled the mdl but don't see my changes. I assumed that a bmake -a would force everything to recompile.

Is there something else I need to do?


[CONNECT C#] How to apply pick lists to other data types than strings

$
0
0

I sucessfully managed to create and apply PickLists to the properties in my Item Types. Really useful!

My problem is that PickList values are strings and I get a data converison error if I try to use the PickList on anything else than string properties. Perhaps I should use the 

PickListValueChangedEventHandler but I cannot figure out how this is done. The documentation is as always quite limited.
Regards,
Krister

VBA & Element ID to Add text.

$
0
0

I am working on a project for a client that doesn't use Reference Files and have nearly 1K files I need to adjust the revision # for and add in 2 signatures.  I am running into problems.  This is my first time writing in VBA, and most of my script has been pulled from multiple sources.  I get the script to run but it doesn't seem to have changed anything in the first file, and the rest are untouched.  Any help would be super duper appreciated.

Sub Test()
Dim fso As New FileSystemObject
Dim fld As Folder
Dim f As File
Dim dgn As DesignFile
Dim elem As Element'Folder Location of .dgn files
Set fld = fso.GetFolder("C:\Users\mneist\Desktop\batchprocesstestfiles")
For Each f In fld.Files'If InStr(LCase(f), ".dgn") > 0 Then
        Set dgn = Application.OpenDesignFileForProgram(f)'Silent Load File'opendgnforprogram dgn
        Dim elementObj As Element'Example'        Dim id As DLong'        id.Low = Numerical ID EX'        Set elem = dgn.GetElementByID(id)'        If elem.IsTextElement Then'        elem.AsTextElement.Text = "Example Text"'        elem.Rewrite'        elem.Redraw'        End If'Examined
        Dim id As DLong
        id.Low = 3451
        Set elem = dgn.GetElementByID(id)
        If elem.IsTextElement Then
        elem.AsTextElement.Text = "ExaminersName"
        elem.Rewrite
        elem.Redraw
        End If'Approved
        id.Low = 345
        Set elem = dgn.GetElementByID(id)
        If elem.IsTextElement Then
        elem.AsTextElement.Text = "ApproversName"
        elem.Rewrite
        elem.Redraw
        End If'Revision #
        id.Low = 23249
        Set elem = dgn.GetElementByID(id)
        If elem.IsTextElement Then
        elem.AsTextElement.Text = "0"
		elem.Rewrite
        elem.Redraw
        End If
        dgn.Save'End If
Next

End Sub

[v8i VBA] Dropped elements of complex chain in attachment has wrong levels

$
0
0

Hi,

I'm using a VBA script to drop all elements of an active file and its attachments and copy them into another file. It has worked fine for years - until now.

Example:
I have an active dgn file with one attachment to it. Exporting elements from the active file is no problem at all, no matter what type.
Now the attachment: inside of it there is a complex chain with a few linestrings and arcs.
If I use Microstations property dialog it shows level "A" for complex chain header and also level "A" for child elements.
When I debug my script it shows level "A" for complex chain header and after dropping that and stepping through returned ElementEnumerator elements those elements have level "B".

It seems like Microstation is not able to get right level information when dropping complex elements that came from an attachment.

Did someone else stumbled across that behavior? What did you do? Any help would be greatly appreciated!

Regards
Stephan

[CONNECT C/C++] mdlDim_setTextStyle missing in lib file

$
0
0

I'm trying to compile som old code from v8i that uses the mdlDim_setTextStyle function. According to the manual the required library is mdlbltin.lib. I have added this, but I still get an unresolved external symbol when compiling. All the other mdlDim functions seems to work. Is this a known issue or do I have to include another library?

Regards

Frode Tørresdal 

Select last

$
0
0

Create a complex shape (lines and arcs) in MStation with CadInputQueue commands, since not available method in VBA

How to put it in an VBA object as last constructed cad element

NOT !!! with selection sets or fences and element enumerators, but as last constructed

Please answer

Viewing all 7260 articles
Browse latest View live


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