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

Load and display a DWG file using C++

$
0
0

Hi,

i am a software developer and my task is to create a plugin for Microstation
which will load a DWG file into the current project and display it.

I tried this code so far:

StatusInt ret = mdlWorkDgn_openFile(&pModelRef, &fileFormat, &is3D, strname, nullptr, true);
ret = mdlModelRef_loadReferenceModels(pModelRef, true, true, true);
ret = mdlModelRef_activateAndDisplay(pModelRef);

Both commands mdlWorkDgn_openFile and mdlModelRef_loadReferenceModels returned 0 while
mdlModelRef_activateAndDisplay returned -126 and the object is not visible in the
current project in Microstation.

What am i doing wrong?


[CONNECT C++] DialogItemHookHandler

$
0
0

In my class derived from DialogItemHookHandler, I'm attempting to use _OnCreate() and _OnDestroy(), but they never seem to be called. I am also using _OnStateChanged() and that IS working. Is there something else I need to do?

Bruce

[Connect C++] tessellation representation for Text

$
0
0

Hi, I am using connect c++ and can query out text information in a model.  however my viewer can't support render text native but only tessellation triangles/meshes. so I would like to know if there is any Connect C++ API can support tessellate text and output a bunch of tessellated meshes(triangles)?

Thanks,

Danny

[Connect C++]Geometry representation of Annotations

$
0
0

Hi, When using connect C++ api to query Annotations (Dimension, Label, Tag, Pattern, Detailing...) I can get various parameter definitions for each type element. in order to draw it in a viewer, I need create geometry representations for each type element and then send it to a viewer. The efforts is pretty significant given so many different annotation types since each type has different parameters definitions. 

Is there some connect C++ api can support get geometry representation of the given element (say a dimension element) so I can send the data to viewer for rendering directly?

Thanks,
Danny

I can get the ECInstance's Relationship instance

$
0
0

I use the following code to try print all the properties and relationship instance of a Element. but i always got the empty list of the relationship. anybody can help me?

 FPUtility.GetCurrentSelectedElements().ForEach(item =>
                    {
                        var hostType = DgnECHostType.All & ~DgnECHostType.File;
                        //hostType = DgnECHostType.Element;
                        var scope = FindInstancesScope.CreateScope(item, new FindInstancesScopeOption(hostType, true));
                        var list = mgr.FindInstances(scope, query);

                        StringBuilder SB = new StringBuilder();
                        foreach (IDgnECInstance instance in list)
                        {
                            if (instance != null)
                            {
                                IECClass ecClass = instance.ClassDefinition;
                                SB.AppendLine(String.Format("{0}:{1}", instance.GetType().Name, instance.Element.ElementId));
                                foreach (Bentley.ECObjects.Instance.IECPropertyValue ecpv in instance)
                                {
                                    if (ecpv != null && ecpv.TryGetStringValue(out string value))
                                    {
                                        SB.AppendLine(String.Format(">{2} ( {0} ):\r\n    {1}", ecpv.AccessString, value, ecpv.Property.DisplayLabel));
                                    }
                                }
                                var  query1 = new Bentley.EC.Persistence.Query.ECQuery(instance.ClassDefinition.Schema.GetClasses());
                                query1.SelectClause.SelectAllProperties = true;
                                Bentley.EC.Persistence.Query.QueryHelper.SelectAllRelatedInstances(query1, true, 1);
                                var scope1 = FindInstancesScope.CreateScope(Session.Instance.GetActiveDgnModel(), new FindInstancesScopeOption(hostType, true));
                                var list2 = mgr.FindInstances(scope1, query1);

                                instance.GetRelationshipInstances().ToList().ForEach(RelationShipItem =>
                                {
                                    SB.AppendFormat(">>RelationShip ClassName:{0}\r\n>>  Source:{1}({2})\r\n>>  Target:{3}{4}\r\n", RelationShipItem.ClassDefinition.Name, RelationShipItem.Source.ClassDefinition.Name, RelationShipItem.Source.InstanceId, RelationShipItem.Target.ClassDefinition.Name, RelationShipItem.Target.InstanceId);
                                });
                            }
                        }

VBA to Generate Schematics from Excel

$
0
0

Please give me program 

VBA to Generate Schematics from Excel

And pls give me details how to install program

On my personal mail I'd "jha.fluor@gmail.com"

Regards

Mukesh

+91 9891041004

[VBA PowerInroads SS4] Is there a way to determine what fonts are listed in the Microstation place text drop down box?

$
0
0

Hi All,

I have a user form that has a list box that I fill with the fonts available to Microstation.  I fill it with only the Microstation fonts since I thought my organization only uses those fonts.  However, I just found out that some installations have the TrueType fonts listed too.  It would be nice if for those installations my program could determine this and also put those into the list.  It's not a problem if this cannot be done, I just thought I'd refine my program to handle this.  Please see the code snippet.

'POPULATE TEXT BOX WITH AVAILABLE FONTS
   Dim i As Long
   i = 0
   Dim myFont As Font
   For Each myFont In ActiveDesignFile.Fonts
      If myFont.Type = msdFontTypeMicroStation Then'ONLY INCLUDE MICROSTATION FONTS
         FontBox.AddItem myFont.Name
         If myFont.Name = previousFont Then'SET INDEX IF PREVIOUS FONT IS AVAILABLE
            FontBox.ListIndex = i
         End If
         i = i + 1
      End If
   Next

Sorry, I did not see a listing for VB under the Language drop down box, so there might not be highlighting.

Is there a way to determine what fonts are in the Microstation drop down box so I can mimic it?

Thanks,

Minion

Tool development

$
0
0

I am a Biginer to development i want to develop tools for V8 2004 edition without using vba 

can any one tell me is i can use visual studio to develeop for it and how can   i get SDK for V8


[CONNECT C++] Non-Persistent Named Group

$
0
0

Suppose that I create a Named Group in memory but never commit it to file. Are there any adverse consequences of making a transient Named Group?

That is, I do this...

NamedGroupPtr pGroup; // Probably a global variable
NamedGroup::Create (pGroup, L"MyGroup", L"Non-Persistent Named Group", NamedGroupFlags (), mdlModelRef_getActive ());

But I don't do this...

pGroup->WriteToFile (false);

[CONNECT C++] Find Named Group

$
0
0

I want to find an existing Named Group in a DGN file. MDL function mdlNamedGroup_findByName (NamedGroupP, ...) looks like it does the job.

However, I don't see a similar method in the NamedGroup class. Since NamedGroup::WriteToFile() requires knowledge of an existing Named Group of the same name, isn't that an omission in the NamedGroup class? Or have I missed something?

[CONNECT C#] Get a list of linestyles

$
0
0

Hi,

I try to get a list of available linestyles. I'm pretty sure this code used to work.

LsDgnFileMap lstyleMap = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile().GetLineStyleMap();

foreach (LsMapEntry lstyleEntry in lstyleMap.GetLsMapEntries())
{
    // Process
}

Now GetLsMapEntries() return an empty collection.

/Krister

[CONNECT C++] Can we have a read-only ElementAgenda

$
0
0

The ElementAgenda provides a collection of elements.  It's useful to enumerate the collection to harvest information.  However, the enumeration methods (e.g. _OnElementModify()) pass a non-constEditElementHandle.

When harvesting information, it would be useful to have a const enumeration method (e.g. _OnElementPeek()) that passes an ElementHandle.  Currently we  have to return an unintuitive !SUCCESS from the enumeration methods to ensure that the element is not modified or removed from the agenda.

[CONNECT C++] Test a NamedGroupPtr's Validity

$
0
0

I wrote this code to test whether a Named Group exists:

NamedGroupCollectionPtr groups  = NamedGroupCollection::Create (*mdlModelRef_getActive ());
NamedGroupPtr           group   = groups->FindByName (name);
return nullptr != group;

The compiler doesn't like that.  It complains about the != operator not matching the type of NamedGroupPtr, and reaches instead for a != operator for a quite different class.

However, this compiles OK:

NamedGroupCollectionPtr groups  = NamedGroupCollection::Create (*mdlModelRef_getActive ());
NamedGroupPtr           group   = groups->FindByName (name);
return group != nullptr;

The documentation of NamedGroupCollection::FindByName() tells us that it returns NULL if the Named Group doesn't exist.  The undefined != operator means that I could not write simply this:

NamedGroupCollectionPtr groups  = NamedGroupCollection::Create (*mdlModelRef_getActive ());
return nullptr != groups->FindByName (name);

Intersection between two 3d lines

$
0
0

Hi,


sorry for my english and thanks a lot in advance for any help.


I'm writing a VBA procedure that lets me creat a connection between two lines or two curves.


In order to do this, I firstly draw a long segment that intersects the two curves. After that I would like to resize this segment using, as "start point" and "end point" the intersections points calculated.

I'm sure that the segment that I drew intersects the two curves but I don't know how to aquire the coordinates of the 3d intersection points.


I try to find a command in VBA which lets me know the point3d of intersection with the  two lines or two curves (BsplineCurve)

I try to use getintersectionpoint and ray3dray3dintersectxy but without any results.

Are these the right commands?

I can eventually attach the part of the code that I have written.

thank you

[CONNECT C++] Placing Nested Cells using DgnPrimitiveTool

$
0
0

I've come across a situation when placing nested cells. The cell, as defined in the cell library, uses two "child" cells for text. The model and the two "child" models have "Is Annotation Cell" enabled. When I place the cell at "full size', everything is fine, If however, I use a different annotation scale, only the "parent" model scales up - the two "child models do not. The child models are marked as "Annotation Purpose" true, and "Is Annotation" false. Is there something I need to do back in the cell library when I referenced the child models so that when placed as a cell, everything respects the Annotation scale?

Bruce


How do I export my business data to i-model

$
0
0

I am about to write some VBA code to put some extra data (business data) on MicroStation elements.

If I want to read these, with element information, when the .dgn file is exported to an i-model, how do I write the data. Which type of element data should I use.

There are several methods, Linkage, Tags, text node etc.

Any good advise?

Performance regression of API Triangulate() in SDK version 05120338

$
0
0

Hi DGN SDK experts,

PolyfaceHeaderPtr::Triangulate() is called in our code base to do triangulation for DGN mesh.

When we upgrading SDK version from 05030235 to 05120338, we found this API has performance regression. Some case has 90% performance regression on this API. Some case has 300% regression.

We would like to know if this is an known issue. 

Please let me know if you need the DGN model to reproduce this issue.

Thank you,

Kevin

[CONNECT C#] DgnElementSetTool Cycling Through Overlapping Elements

$
0
0

I cannot seem to cycle through overlapping elements when selecting an element when using the DgnElementToolSet. I thought it had to do with enabling AccuSnap and overriding another method(?). I thought I remembered seeing a similar post prior, but cannot find it.

[CONNECT C++] Dropping a Nested Cell

$
0
0

I'm attempting to drop a nested cell. I wish to keep the individual sub-cell elements, just remove the embedded cell headers. I'm attempting to use DisplayHandler::Drop(). I can seem to "drop" the cell fine, but I'm having trouble "replacing" the original EditElementHandle with the "updated" contents:

	bool	CreateGraphic(EditElementHandleR eeh, DgnButtonEventCR ev)
	{
        DropGeometryPtr			dropPtr = DropGeometry::Create();
        dropPtr->SetOptions(DropGeometry::OPTION_Complex);
        ElementAgenda			dropGeom;			// ElementAgenda is a bvector of EditElementHandle.
        StatusInt				iStatus = eeh.GetDisplayHandler()->Drop(eeh, dropGeom, *dropPtr);
        EditElementHandle		eehNormal;
        NormalCellHeaderHandler::CreateOrphanCellElement( eehNormal, L"BRUCETEST", true, *ACTIVEMODEL);
        for each (EditElementHandleCR eh in dropGeom)
        {
        	NormalCellHeaderHandler::AddChildElement(eehNormal, (EditElementHandleR)eh);
        }
        NormalCellHeaderHandler::AddChildComplete(eehNormal);
        eeh.Invalidate();
        eeh = eehNormal;    // How to get eehNormal back into eeh so it can be returned ??

		return eeh.IsValid();
	}

Thanks,

Bruce

Passing data prom one thread to another

$
0
0

Passing data prom one thread to another

Hi,
I have created a process that's runing a thread that open some windows form, now i want that other
running threads from the same process will be able to pass data to this windows form or even close it or reopen it.

The Windows form GUI is always in use of the end users so i cant lock.
what is the best way to implement it in c# ? i would like a short example, thanks.

Viewing all 7260 articles
Browse latest View live


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