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

mdlModelRefIterator_getNext (iterator)

$
0
0

I am attempting to cycle through all the cells in a library by stepping through the models. The following code would

seem to be a logical way to achiever this. However, it retrieves only the current (active) model, and then the process

exits (no further processing). What am I doing incorrectly?

mdlModelRefIterator_create (&iterator, MASTERFILE, MRITERATE_Root | MRITERATE_PrimaryChildRefs , -1);
while (modelRefP = mdlModelRefIterator_getNext (iterator))
{
     mdlModelRef_getModelName (modelRefP, WmodelName);
     mdlCnv_convertUnicodeToMultibyte (WmodelName, -1, modelName, sizeof(modelName));
     printf ("Model Name-> %s\n", modelName);
}

On a side note, when I attempt to cycle through all the cells with the following code (using an index iterator), it performs as

expected and steps through each cell (model).

fileObj = mdlModelRef_getDgnFile(MASTERFILE);
ndxIterator = mdlModelIterator_create (fileObj);
mdlModelIterator_setAcceptCellsOnly (ndxIterator, TRUE);
while (NULL != (IndexItem = mdlModelIterator_getNext (ndxIterator)))
{
mdlModelItem_getName (IndexItem, WmodelName, MAXFILELENGTH);
mdlCnv_convertUnicodeToMultibyte (WmodelName, -1, modelName, sizeof(modelName));
mdlModelItem_getDescription (IndexItem, WmodelDesc, MAXFILELENGTH);
mdlCnv_convertUnicodeToMultibyte (WmodelDesc, -1, modelDesc, sizeof(modelDesc));
printf ("Model Name-> %s Description-> %s\n", modelName, modelDesc);

}

Any suggestions?

Larry Durke


Cannot find Bentley.Microstation in c#

$
0
0

Hello All, 

I am very green in Microstation Connect Edition programming so please go easy.  

I am currently writing my C# MDL based off of a old co-workers, but he had originally written his code in vb.net.  All the libraries and references seemed to work fine for him.  My issue is pretty basic, Visual Studio 2015 consistently cannot find the library Bentley.Microstation even though I see that it exists in vb.net.  

I found a forum that is similar to my question but there was only one reply and it doesn't seem to help: https://communities.bentley.com/products/programming/microstation_programming/f/archived-microstation-v8-xm-edition-programming-forum/22466/i-am-not-getting-the-bentley-microstation-addin-and-addinattributes

Could someone point me into the correct direction on why Bentley.Microstation is non-existent?  Below you will find a screen grab of my references.   

Apologies if this seems like a simple issue but I am having issues finding documentation on Libraries, Namespaces and Classes regarding C# MicroStation Connect Programming.  Would you folks happen to know of a better resource as this Bentley Communities page seems like the only maintained resource out there.

Much Thanks and cheers

Automatic adding and editing metadate of .dgn file

$
0
0

Hi everyone,

I have the following problem with working on .dgn files. Namely, I want add some information into properties of microstation file and then have the easy possibility to edit them. I'm working on the thousands of files, so I need to do it automaticly, for example by macro in VBA. It will be perfect if I could export these information from excel directly through the metadates of .dgn file. I will be very grateful of every help on it.

Best regards

Michal 

3D modeling

$
0
0

Hello, MicroStation ... its developers!

I'm working with MicroStation  for more then 20 years - main activity - modeling of 3d timber frame constructions - then detailing of these models till workshop drawings and production lists (a lot of VBA macros written to support this process). Until MicroStation  edition V8i everything was wonderful … unfortunately Connect edition brings some inconveniences to me  ..

Some of them here:

1) macro commands, perfectly worked on V8i before on Connect edition fails … OK, MicroStation warned me about necessity to review them … however by trying to repair them I faced unexplainable errors (seems that VBA still in BETA condition)  … now I have to export my Connect model to V7i, then import in MicroStation v8i , make some level corrections, appeared during reexporting, only than I can run my macros …. all this sad, but I can deal with it..

2) Connect edition seems to me very convenient, especially for modeling ( interface, tools e.t.c.) …. but my main concern is about SmartSolids future … new Parametric solids for me unusable (thousand's of parts with hundreds of variations - created by cutting multiple solids, uniting (substracting) them, then cutting them again, then extruding some edges, then adding some holes - a lot of creative attacks to model afterwards it is created … then final decision and workshop drawings) …. only thing that can withstand this is SmartSolid ….. today I have to use "convert to smart solid" hundreds of times - each time I extrude face of solid (I would use Legacy extrude face tool (of course), but unfortunately, it lacks with Accudraw snapping) …. please do not remove SmartSolids "Legacy :("  until you can replace them with something worthy … 

3) by working with 3D model in Connect edition snapping to the element through solid (also transparent solid) currently unavailable (v8i edition supports this feature) … its vital for fluent modeling (very, very )  …. 

Have a good day, Ugis.

[CONNECT VBA] Where is mdlLevelLibrary_importWithFiltersEx?

$
0
0

Hi,

I'm trying to convert old VBA code from v8i to Connect edition but there is an error saying "Can't find DLL entry point mdlLevelLibrary_importWithFiltersEx in stdmdlbltin.dll". Where is it implemented?


 #If VBA7 Then
    Declare PtrSafe Function mdlLevelLibrary_importWithFiltersEx Lib "stdmdlbltin.dll" ( _
        ByVal pFileNameIn As LongPtr, _
        ByVal levelLibraryFormatIn As Integer, _
        ByVal importByMethodIn As Integer, _
        ByVal modelRefIn As LongLong) As Long
 #Else
     Declare Function mdlLevelLibrary_importWithFiltersEx Lib "stdmdlbltin.dll" ( _
        ByVal pFileNameIn As String, _
        ByVal levelLibraryFormatIn As Integer, _
        ByVal importByMethodIn As Integer, _
        ByVal modelRefIn As Long) As Long
#End If


Public Sub test_importWithFiltersEx()
   For i = 1 To ActiveModelReference.Attachments.count
        Dim cAtt As ModelReference
        Set cAtt = ActiveModelReference.Attachments.item(i)
        Status = mdlLevelLibrary_importWithFiltersEx(StrPtr("C:\connect tests\oveerrides_test.dgnlib"), LEVEL_LIBRARY_FORMAT_DGN, 1, cAtt.MdlModelRefP)
        Status = mdlLevelTable_rewrite(cAtt.MdlModelRefP)
    Next i
End Sub

[AECOsim V8i SS6 C++] Datagroup: Choose Catalog and Item

$
0
0

Hello,

Like to choose a DataGroup Catalog Item from the Dataset, like in “Instance add”

  

In the delivered samples are only cases to change an existing DataGroup instance, if you know already the name of the catalog and of the item.

I could read the XML-files by myself, but I guess this would be unnecessary extra work.

Is there a sample, How I could rebuild the functionality of this toolsetting-dialog?

Tanks!

[MStn CE U13 C#] How to receive "full attachment path" from DisplayPath?

$
0
0

Hi,

I am "playing" with DgnElementSet tool in C# using this data:

  • To an active mode, a reference is attached twice.
  • First attachment it's direct attachment of the file and model.
  • The second attachment is realized through several other files (nested live attachment).

I analyzed DisplayPath (HitPath) I received in OnDataButton method, but it always contains only the model where the located element is saved (root element), alternatively more records when the element is nested in complex element.

Originally I assumed (because I have no reason to check what is "inside DisplayPath" yet ;-) that DisplayPath contains a full path (a chain of ref attachments), but now in my code, it's alwyas "flat" even when the element is "several references far".

I'd like to ask for help to identify whether:

  • It's bug in API
  • I have to configure something in DgnElementSetTool
  • I have to use another class (maybe PersistentElementPath?) to construct full chain from received DisplayPath

MicroStation itself is aware of the nesting, information is displayed in Message Center when I located element. I am also aware of GetPathDescription method, but it returns string, not a list of ModelRefs or DgnAttachmentRefs or something similar.

or ?

With regards,

  Jan

[V8i SELECTseries 10 VBA] Record/track tool usage?

$
0
0

I'm trying to determine if it is possible to create some code (preferably VBA) that will record/track user key-ins and tool usage during all MicroStation V8i sessions on their computer, perhaps recording results by appending each new item to a delimited text file which I could then import to Excel and use to create a count of tool usage. Ideally, I would like to know everything they are using in MicroStation.

The reason I'm asking is that I have several custom tools and interfaces which need to be updated as we are transitioning to CONNECT. I would like to find out what tools people are using the most, so I can focus on those tools first. This would also help when creating our custom user interface, placing the most used tools upfront from the beginning. Of course, I'm going to talk to people and ask what they use, but I think this would also help a great deal. Our memories can be flawed after all. 

I've looked at MicroStation Events, but they appear to only track design file open/close. I'm also looking at IChangeTrackEvents but this seems to be focused on recording design file changes only (e.g. element added, modified, removed, etc.) and not the actual tools that are being used. 

Is there something that can record all interactions in MicroStation? Any suggestions or direction would be very appreciated. Thanks!


[MSV8i c++]在ComboBox的文本框中编辑,下拉框实时显示匹配的列表,在监听的DITEM_MESSAGE_POSTKEYSTROKE状态下如何获取当前文本框的值

$
0
0

调用mdlDialog_itemGetValue,mdlDialog_itemGetState也获取不到当前编辑后的文本档的值,请问如何实现?

[CONNECT C++] CurveVector and Obtaining an Arc from an Ellipse

$
0
0

I am developing a tool that requires the user to pick two crossing lines. The intersection of these two lines is used as the center for an ellipse that dynamically changes it's radius as the cursor is moved. I calculate the locations where the ellipse crosses the lines:

CurveCurve::IntersectionsXY()

With the result, I can iterate those intersections:

for each (ICurvePrimitivePtr	curvePtr in *pointsOnEllipse)	// this contains points ONLY IF the lines actually intersect...
{
	DPoint3d				ptOnEllipse;
	curvePtr->GetStartPoint(ptOnEllipse);
	...
}

I wish to obtain arcs between those intersection locations. I have tried this:

				CurveVectorPtr					testArc = ellipse->CloneBetweenCyclicIndexedFractions(0, 0.0, 0, 1.0);

but I have several questions:

CloneBetweenCyclicIndexedFractions() needs indexes and fractions. How can I go from the ICurvePrimitivePtr(s) returned from CurveCurve::IntersectionsXY() to the required indexes and fractions so that I get arcs? Also, once I've got those CurveVectorPtr "arcs", how do I get them into an EditElementHandle?

Additionally, how many indexes does an ellipse have? 4?

Bruce

[CONNECT C++] CurverVector::CloneBetweenCyclicIndexedFractions()

$
0
0

I wish to "create" an arc from an ellipse. I have the fractions of the ellipse that I wish to clone between. However, I have a case where I need the portion of the ellipse that lies across the "end" (fraction =1.0) and extends to where the fraction is > 0.0. For example, I wish to clone the portion of the ellipse from the fraction 0.85 to 0.125. My attempts with 

ellipse->CloneBetweenCyclicIndexedFractions(0, 0.85, 0, 0.125);

will return the portion from 0.125 to 0.85 and NOT the section from 0.85 to 0.125. Is it possible to return (i.e. Clone) across the start/end of an ellipse? I tried to clone two CurveVectors (0.0 to 0.125 and 0.85 to 1.0) then "Add()" them, but my tool immediately crashes:

CurveVectorPtr	Arc = ellipse->CloneBetweenCyclicIndexedFractions(0, 0.0, 0, 0.125);
CurveVectorPtr  Arc2 = ellipse->CloneBetweenCyclicIndexedFractions(0, 0.85, 0, 1.0);
Arc->Add(Arc2);
// crashes here creating the EditElementHandle
DraftingElementSchema::ToElement(eehArc, *Arc, nullptr, ACTIVEMODEL->Is3d(), *ACTIVEMODEL);

Updating Z values of a linestring element's vertices points. Applying the changes is not showing.

$
0
0

Currently am using Microstation CONNECT (Update 10).  Visual Studio 2015 Professional, c#, updating a DGN file.  

The concept of my tool is to loop of a collection of selected elements (Linestrings) and compare each line string with one another to see if there are any intersecting points.  My method is to take a line, and compare it with each other line (1 at a time), and then compare the points of each line to see if there are any matching (X,Y) values, both X and Y values need to match.  If there is a match between two linestring elements, then I will continue to check if the Z values are different, if they are different then I will take the average of the two Z values and assign the new averaged value to each point of the lines.  

My current problem is, after I assign the Z values and then call either Element.Rewrite() or Element.Redraw, then nothing will happen.  Could anyone assist me in "Applying" the values so the change in Z values actually shows up?  

I understand that my method of finding intersecting points is not necessarily the most efficient, but that is something I look to optimize later.  I current concern is why the Z values will not update after I set a new z-value.

I have previously referred to this forum here:

https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/96252/how-to-modify-elevation-z-values-of-linestring-to-match-another-linestring

Thanks ahead of time all,

Cheers

c# code below:

Main()
{
            B.ElementEnumerator ee = BMI.Utilities.ComApp.ActiveModelReference.GetSelectedElements();
            B.ElementEnumerator eeInnerLoop = BMI.Utilities.ComApp.ActiveModelReference.GetSelectedElements();

            while (ee.MoveNext())
            {
                try
                {
                    var CurrentBreakLine = ee.Current;
                    if (CurrentBreakLine.Type.ToString().ToLower() == "linestring")
                    {
                        while (eeInnerLoop.MoveNext())
                        {
                            var comparingBreakLine = eeInnerLoop.Current;
                            if (CurrentBreakLine.ID != comparingBreakLine.ID)
                            {
                                CompareTwoBreakLines(CurrentBreakLine, comparingBreakLine);
                            }                           
                        }
                        eeInnerLoop.Reset();
                    }
                }
                catch(Exception e)
                {
                    MessageBox.Show(e.Message);
                }                                                
            }
}

public void CompareTwoBreakLines(B.Element currentline, B.Element NextLine)
        {
            var currentLineElement = currentline.AsLineElement();
            var nextLineElement = NextLine.AsLineElement();

            int currentVerticeCount = currentLineElement.VerticesCount;
            int nextlineVerticeCount = nextLineElement.VerticesCount;

            B.Point3d[] currentLinePoints = currentLineElement.GetVertices();
            B.Point3d[] nextLinePoints = nextLineElement.GetVertices();

            int outerIndex;
            int innerIndex;

            for (outerIndex = 0; outerIndex <= currentVerticeCount - 1; outerIndex++)
            {
                double currentXValue = currentLinePoints[outerIndex].X;

                for (innerIndex = 0; innerIndex <= nextlineVerticeCount - 1; innerIndex++)
                {
                    double nextLinesCurrentXValue = nextLinePoints[innerIndex].X;
                    if (currentXValue == nextLinesCurrentXValue)
                    {
                        double currentline_YValue = currentLinePoints[outerIndex].Y;
                        double nextLines_YValue = nextLinePoints[innerIndex].Y;
                        if (currentline_YValue == nextLines_YValue)
                        {
                            //Find averages to set Z values between the two current Z Values
                            double z1 = currentLinePoints[outerIndex].Z;
                            double z2 = nextLinePoints[innerIndex].Z;
                            if (z1 != z2)
                            {
                                double newZValue = (z1 + z2) / 2;
                                currentLinePoints[outerIndex].Z = newZValue;
                                currentline.Rewrite();
                                ////currentline.Redraw();  I have tried redraw here as well instead of rewrite
                                nextLinePoints[innerIndex].Z = newZValue;
                                NextLine.Rewrite();
                                ////NextLine.Redraw();  I have tried redraw here as well instead of rewrite
                            }
                        }
                    }
                }
            }
        }

[CE U13 C#] Get a list of available TextStyles

$
0
0

Hi,

I know this has been asked before but perhaps there are any updates on this matter.

The method DgnFile.GetTextStyles() only seems to return the TextStyles in the active designfile (if DgnFile the active designfile).

I therefore tried the following code but no dgnlibs are found, and yes, there is a dgnlib containing TestStyles in MS_DGNLIBLIST.

ArrayList textStyles = new ArrayList();

BM.DgnLibIterator iterator = new BM.DgnLibIterator(BM.DgnLibSelector.TextStylesOnly);

// Get styles in active file (works fine for the active file)
foreach (BDPN.DgnTextStyle textStyle in DgnHelper.GetActiveDesignFile().GetTextStyles())
{
  textStyles.Add(textStyle.Name);
}

// Get styles in dgnlibs (no dgnlibs found)
foreach (BDPN.DgnFile dgnlib in iterator)
{
  foreach (BDPN.DgnTextStyle textStyle in dgnlib.GetTextStyles())
  {
    if (textStyles.Contains(textStyle.Name) == false)
    {
      textStyles.Add(textStyle.Name);
    }
  }
}

[CONNECT C++] Element Transparency during _OnDynamicFrame()

$
0
0

I've placed an ellipse in my model, enabled Transparency in the View Attributes, filled the shape and changed the shape's Transparency value. The element displays with the expected transparency. In my tool's code, I create an ellipse, and set it's fill and transparency:

IAreaFillPropertiesEdit		*fillProps = dynamic_cast<IAreaFillPropertiesEdit*>(&eeh.GetHandler());
UInt32						fillColor = 23;
bool						alwaysFill = true;
fillProps->AddSolidFill(eeh, &fillColor, &alwaysFill);

ElementPropertiesSetterPtr		propSet = ElementPropertiesSetter::Create();
propSet->SetTransparency(.95);
propSet->Apply(eeh);

However, when the ellipse displays in _OnDynamicFrame(), the ellipse is not transparent (I have ensured that the view's transparency is enabled). Might that be due to the way I'm setting the RedrawElems object?

	RedrawElems redrawTool;
	redrawTool.SetDrawMode(DRAW_MODE_TempDraw);
	redrawTool.SetDrawPurpose(DrawPurpose::Dynamics);
	redrawTool.SetDynamicsViews(IViewManager::GetActiveViewSet(), ev.GetViewport());
	redrawTOol.DoRedraw(eeh);

Thanks,

Bruce

macros

$
0
0

regards,
I would like to make a macro in which I multiply the measure that I type by 60.
I have no idea how I can do this is the first time I would do a macro.
I appreciate your attention and the collaboration you can give me.

Atte.
Carlos Velasquez
Bogota Colombia


Macros

$
0
0

regards,
I would like to make a macro in which I multiply the measure that I type by 60.
I have no idea how I can do this is the first time I would do a macro.
I appreciate your attention and the collaboration you can give me.

Atte.
Carlos Velasquez
Bogota Colombia

[CONNECT C#] add custom property type to item type array property.

$
0
0

i have an item type that contains a property. this property has Is Array set to true and its type is a custom property type that i made.

trying to figure out how to add a value to this array property. 

Not seeing it in the sdk. i see there is a XmlStringValue that is a get/set. but when i try to set it, it just crashes. assuming i cant use that to add a new value to an array but could use it to change existing values??

Anyways anyone see a way to do this. i hope im just missing it.

Navisworks exporter with connect

$
0
0

I am trying to use the nwexport17.ma with Microstation connect and it will not load.

I am guessing that it is a compatability issue with moving to connect.

Is there an easy way of upgrading the ma to work with connect.

Is there anybody out there that has already done it.

I do not have the time to be learning how to write code.

My fall back will to be to install SS10 to see if the ma works.

[CE U13 VBA/C#] Get a list of Level Filters

$
0
0

Hi,

Is it possible to get a list of available level filters, preferably also those in dgnlibs?

Primarly from VBA but C# would be helpful to.

/Krister

If installed Connect Edition and my Listview in my vba apps doesn't exist anymore

$
0
0

If installed Connect Edition and my Listview in my vba apps doesn't exist anymore.

I have tried numerous MSCOMCTL.ocx files and no luck.

How do I get the Listviews to work in Connect Edition 13?

We are running the 64 bit version of Connect Edition.

Viewing all 4331 articles
Browse latest View live


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