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

Attributes Bylevel in VBA

$
0
0

Hi everybody again ,

Please , one question that may be anybody can helps me :

If I wan't to read the attributes ( Color , type , style , weight) of a element in VBA for Microstation V8i , I have seen that if you know the level , by this way , I can know the value of attributes of the element , with the code attached.

But , there is any way to find the attributes of a element ( that are defined Bylevel , value -1) without know the level_name or level_code ???

If I access to the attributes directly , element.color or element.style it returns me a value -1 ...

Any idea ????.

Thanks in advanced for your help !!!

The code attached :

    For Each oLv In ActiveDesignFile.Levels
        If oLv.Name = Main.txtNivell.Text Then
            Main.txtColor.Text = oLv.ElementColor
            If oElement.IsCellElement Then
                Main.txtNivell.Text = oElement.AsCellElement.Name
                Main.txtCella.Text = oElement.AsCellElement.Name
            Else
                Main.txtCella.Text = ""
            End If
            Main.txtGruix.Text = oLv.ElementLineWeight
            Main.txtEstil.Text = oLv.ElementLineStyle.Name
            Main.txtClasse.Text = oElement.Class
            Main.txtTipus.Text = oElement.Type
        End If



VBA and Reading DMRS Linkages - Can it be done

$
0
0

I need to read the HEX words from a DRMS linkage. I've always dealt with creating my own msLinks using 'Dim oDBLink As DatabaseLink' for 16 years.
However, I have the decoder ring from the vendor to read and interpret this data but have been searching for a method to read this data.
I am hoping that I do not have to backtrack to old MDL language, but use MicroStation VBA to do this by perhaps calling a mdl Function.

-Thank you

[Connect C#] Recreating Element.ConstructVertexList from VBA Api using the DgnPlatformNET api

$
0
0

I am trying to recreate the Element.ConstructVertexList(double tolerance) method from the VBA Api using the DgnPlatformNET api.

Below is what I have come up with. The problem I am having is that on BSplines. I am not getting the same results.

For example, on a bspline representing a straight line with 3 vertices falling on the same straight line. the Vba API will return the 3 vertices.

The below method I created returns around 8 vertices all spaced equally on the spline..

On line strings, the vertices are returned as intended.

 

        /// <summary>
        /// Generate a list of vertices that represent the attached element.
        /// </summary>
        /// <param name="tolerance">Tolerance for reconstruction of vertex list.</param>
        /// <returns>List of vertices</returns>
        public List<DPoint3d> ConstructVertexList(double tolerance)
        {
            List<DPoint3d> results = new List<DPoint3d>();
            if (_curveVector == null)
                return results;
            FacetOptions options = FacetOptions.New();
            options.SetCurveDefaultsDefaults();
            options.SetDefaults();
            options.ChordTolerance = tolerance.ToUor();
            
            CurveVector newEle = _curveVector.Stroke(options);
            List<CurvePrimitive> primitives = GetPrimitives(newEle);

            foreach (CurvePrimitive prim in primitives)
            {
                List<DPoint3d> points = new List<DPoint3d>();
                prim.TryGetLineString(points);

                results.AddRange(points.Select(p => p.FromUor(_model)));
            }

            return results;
        
        }

CONNECT SDK : mdlRefFile_beginnAttachmentToModel/mdlRefFile_completeAttachment

$
0
0

 who has already used mdlRefFile_beginnAttachmentToModel/mdlRefFile_completeAttachment ?

How to create/initialize the builder argument ?

How to handle the pipe ('|') character

$
0
0

Right now I am utilizing the CadInputQueue.SendCommand() method to send custom commands to the ActiveDocument. There are some commands which contain the pipe character ('|') within them.

[For example: "append|macro daoff"] 

The entire command is generated from a spreadsheet, where the columns are split into LayerName, Color, LineStyle, Weight, Font, Font Justification, as well as others, but the final column is the custom command, which is where the above line is located in. All other parts I have written working code to handle, but this type of custom command seems to not work due to the pipe character.

I am rather new to programming within MicroStation. I have read that this type of coding for drawing within MicroStation by utilizing the SendCommand() is a poor choice, but given what we have already set up, converting everything to a more "proper" way was not in the budget (time-wise), so this was what I had to do. That said, can I get assistance with how to make this work with what I have?

I believe the pipe is essentially telling me to split the command into two commands, but that doesn't seem to work, or perhaps I am splitting it incorrectly.

private static void SendCommand( MicroStationDGN.ApplicationClass ustn, string command )

{

var splitCommand = command.Split( '|' ).ToList();

foreach(var cmd in splitCommand)
{

ustn.CadInputQueue.SendCommand( tempCommand, true );

}

}

Procedure to search the value from the Excel in a Microstation files

$
0
0

Hi all,

Should I create a macro or procedure to search the value from the Excel file in a Microstation files.

I have a value (text or number) written to Excel
I want to create a link that searches the value (text or numbers) on the dgn file.

Thank you soo much.

Macro help

$
0
0




My English is very poor. needs help in improving macra. Action macra is that the 3D drawing when you click on
two adjacent points of known height (Z) are inserted at the point of full meters
(eg. Between points from the 200.48 m - 210.51 m insert points to 200.5 m, 201 m 201.5 m, etc)
everything works well only is one of the fundamental problems that can not help themselves. when you click in a place
where the mute point with a known height Z closes Microstation. Macro version of Microstation V7 SE modified to select V8i series 3 please help

Sub main ()
 dim A as mbepoint
 dim B as mbepoint
 dim C as mbepoint
 Dim view as Integer
 dim Cięcie as Double
 dim kom$ as String
 
 kol%=MbeSettings.color
 Początek:
 kom = "NULL"
  MbeSendCommand "active level 1 "
 MbeSendCommand "NULL"
 MbeSendCommand "Place Line"
 
 
 MbeGetInput MBE_DataPointInput, MBE_CommandInput, MBE_ResetInput
 Select Case  MbeState.inputType
 Case MBE_DataPointInput
    If MbeState.getInputDataPoint (A, view) = MBE_Success Then
    MbeSendDataPoint A
    End If
 Case MBE_CommandInput
    If MbeState.getInputCommand (kom$) = MBE_Success Then
        GoSub Koniec
    End If
 Case MBE_ResetInput
    GoSub Początek
 End Select
 
 
 
 MbeGetInput MBE_DataPointInput, MBE_CommandInput, MBE_ResetInput
 Select Case  MbeState.inputType
 Case MBE_DataPointInput
    If MbeState.getInputDataPoint (B, view) = MBE_Success Then
    End If
 Case MBE_CommandInput
    If MbeState.getInputCommand (kom$) = MBE_Success Then
        GoSub Koniec
    End If
 Case MBE_ResetInput
    GoSub Początek
 End Select


 
 Cięcie = 0.5
 
 
 If A.z > B.z Then
    C=A
    A=B
    B=C
 End If    
 
 MbeSendCommand "Active Angle Pt2"
 MbeSendDataPoint A
 MbeSendDataPoint B
 MbeSettings.Angle = MbeSettings.Angle - PI/2
 
If (B.z-A.z)< 50 then
 Dx# = (B.x-A.x)/(B.z-A.z)*Cięcie
 Dy# = (B.y-A.y)/(B.z-A.z)*Cięcie
 
 Pz# = Cięcie - (A.z - Fix(A.z))
 While Pz <= 0
  Pz = Pz + Cięcie
 Wend
 
 C.z = A.z + Pz
 C.x = A.x + Pz*Dx/Cięcie
 C.y = A.y + Pz*Dy/Cięcie
 While C.z < B.z
    color# = (C.z/10 - Int(C.z/10))*10/Cięcie
    MbeSettings.color = val(Format$(color,"0,0"))
   
   
    
    MbeSendCommand "PLACE TEXT"
    
    
    Z$ = Format$(C.z,"0,0.0")
    Z$ = Mid$(Z,Len(Z$)-2,Len(Z$))
   ' MbeSendKeyin Format$(C.z,"0,0.0")
     MbeSendKeyin Z$
   
   
   
   
    MbeSendDataPoint C
    C.z = C.z + Cięcie
    C.x = C.x + Dx
    C.y = C.y + Dy
 Wend
 
End If
 
 MbeSendCommand "NULL"
 Gosub Początek
 Koniec:
 MbeSettings.color = kol
 MbeSendCommand kom
'MbeMessageBox format$("Pz,"0,0.00"")
End Sub
 


[V8i MicroStationAPI] ElementFacetOptions

$
0
0

I'm passing a class that inherits from ElementFacetOptions  to my ElementGraphicsProcessor.  I need a custom version because I want the facetiser to produce triangles, so I do this...

class CMyClass: public Bentley::Ustn::ElementFacetOptions
{
	virtual int  GetMaxPerFace ()	{ return 3;		};
};

However, there are a number of additional pure virtual functions that I must also implement...

virtual double  GetChoordHeightTolerance ()=0 
virtual double  GetNormalAngleTolerance ()=0 
virtual bool  NormalsRequired ()=0 
virtual bool  ParamsRequired ()=0 

But I don't know what those values should be, and I can't see the defaults. I don't even understand what the last ParamsRequired is asking.

Those methods are pure virtual and don't have an implementation in Bentley::Ustn::ElementFacetOptions.  That is, I can't do this...

virtual double CMyClass::GetChoordHeightTolerance  ()
{
  return __super::GetChoordHeightTolerance (); // not implemented
}

Attributes of the activeSettings bylevel

$
0
0

Hi again to everybody ,

Anybody knows , how can I get the value of the attributes of the active settings when are bylevel ??.

With this code ,  I get the value , but if are bylevel it returns me -1 or bylevel ... any idea???

Thanks !!

With ActiveSettings
    Main.txtColor.Text = .color
    Main.txtNivell.Text = .Level.Name
    Main.txtGruix.Text = .LineWeight
    Main.txtEstil.Text = .LineStyle.Name
    Main.txtCella.Text = ""
    Main.chkCella.Value = False
    Main.txtTipus.Text = -1
    Main.txtClasse.Text = -1
End With



[CONNECT C++] How to set version number of application

$
0
0

How do I set the version number of a MDL application in MicroStation CONNECT Edition? In v8i we used the mdlSystem_setMdlAppVersionNumber function. But this function do not have any effect in CONNECT. At least the MDL application dialog do not show the version number. 

I would also like to know if there is an easy way to set the version on the dll making it wisible on the properties of the DLL.

Regards

Frode Tørresdal 

Grid display will not stay turned off

$
0
0

The grid display will not stay turned off after turning it off in all views and saving the settings. Each time I have done this it comes back on. I do not need to use it when I am working the 3d model where it is particularly distracting.

I know about the view attributes but is there a key-in that just turns the grid display off?

The View Attributes command and the key-in are toggles and are of no help with this.

I have a basic command routine that fits the drawing to full view when I click the Open command icon:

 

'created 01/23/2015

'*************************************************************************************************
Sub main
   'Dim startPoint As MbePoint
   'Dim point As MbePoint, point2 As MbePoint

'*************************************************************************************************


' BEGIN SET UP OF VIEW ONE DISPLAY
' PLACE VIEW ONE DISPLAY SETTINGS HERE
' SETS THE DISPLAY WINDOW FOR VIEW ONE

'   Start a command
 
    MbeSendCommand "view off all "
   
' BEGIN SET UP OF VIEW ONE   
' BEGIN SET UP OF VIEW ONE
' BEGIN SET UP OF VIEW ONE

  MbeSendCommand "VIEW ON 1 "
   
  MbeSendCommand "WINDOW TILE "
   
  MbeSendCommand "FIT VIEW EXTENDED "

'========================
'REVISED 09/28/2016 REMOVED ALL SETTINGS FOR AXIS SNAPS AND ASSOCIATION 
'========================

'  MbeSendKeyin "CT=J:/color.tbl "    '08/28/2015 blm

'  MbeSendCommand "lock axis off "
 
'  MbeSendCommand "active axis 90 "
 
'  MbeSendCommand "accusnap off "
 
'  MbeSendCommand "lock snap keypoint "
 
'  MbeSendCommand "lock association on "

  MbeSendCommand "filedesign "
 
  MbeSendCommand "dialog openfile "


' END SET UP
End Sub

 

 

[CE C#] Sizing problem of Toolbar by WPF

$
0
0

When I was trying to play how to use WPF to create a toolbox with VS 2015 Tools for MicroStation CONNECT Edition , I found that I couldn't fix or change the Window size. Glad if someone could provide the comment as following:

  1. ResizeMode, WindowStyle cannot help fix the toolbox
  2. Toolbar_SizeChanged cannot help resize the toolbox
namespace MSAddinSample
{

    public partial class Toolbox : UserControl
    {
        private static Bentley.MstnPlatformNET.WPF.DockableToolbar currentControl;
        private static Bentley.ResourceManagement.IMatchLifetime BRI;
        private Bentley.MstnPlatformNET.AddIn m_addIn;

        public Toolbox(Bentley.MstnPlatformNET.AddIn addIn)
        {
            m_addIn = addIn;
            InitializeComponent();
            
        }

        internal static void ShowWindow(Bentley.MstnPlatformNET.AddIn addIn)
        {
            if (null != currentControl)
            {
                currentControl.Focus();
                return;
            }
            
            currentControl = new Bentley.MstnPlatformNET.WPF.DockableToolbar();
            currentControl.ResizeMode = System.Windows.ResizeMode.NoResize;
            currentControl.WindowStyle = System.Windows.WindowStyle.ToolWindow;
            currentControl.Content = new Toolbox(addIn);
            currentControl.Attach(BRI, 'control');
            currentControl.Show();
            //currentControl.WindowContent.CanDockVertically = false;
        }

        private void Toolbox_Unloaded(object sender, System.Windows.RoutedEventArgs e)
        {
            currentControl = null;
        }

        private void Toolbar_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            currentControl.Width = 200;
            currentControl.Height = 30;
        }
    }

[V8i MicroStationAPI] Facetting Anomaly

$
0
0

(Please visit the site to view this file)

The attached DGN file default model contains an anomalous type 19 green solid.  When I facetise this using the ElementGraphicsProcessor API it behaves oddly.  I have asked the ElementGraphicsProcessor to produce triangles, but this solid results in 20 vertices that don't form a set of triangles.

I realise that it's an odd construction, and I don't know its provenance.  It was probably created by another CAD tool.  Is there a way in which I can ask the ElementGraphicsProcessor to tell me when it can't do what I ask?

[V8i C++] Introvert Torus has Zero Volume

$
0
0

(Please visit the site to view this file)

The attached DGN file's default model shows a small number of solid elements.  Focus on the red 'sphere'.  It turns out to be constructed from a torus (mdlSurface_revolutionIsTorus() returns TRUE), although I don't understand how nor do I know its provenance.

However, the torus has negligible volume, even though it's several metres in diameter.  Why does it measure no volume?  Is it the MicroStation equivalent of a Klein bottle

The blue sphere was created using MicroStation's tool for comparison purposes, and behaves as one would expect.

Helix method generates inconsistent B-Splines

$
0
0
I am using the Helix method and CreateBsplineCurveElement1 to create a helical curve. I create, for example, a helix 
with start and end radius of 1, a start point of {1,0,0} and an axis from {0,0,0} to {0,0,1} and a pitch of 1. If I
now create another helix changing only the height, such as an axis from {0,0,0} to {0,0,1/3}, then the resulting helix
passes through the first helix at the start, end and midpoints but is higher or lower everywhere else, as shown in the
image below.

This seems to be related to the question here:
http://communities.bentley.com/products/products_generativecomponents/f/360/t/96280

It appears to me that the Helix method incorrectly calculates the control points and/or weights for the
resulting B-Spline.

Any ideas on how to fix this?



VBA Code Question

$
0
0

Trying to understand some existing code that is changing the value of Tag data. The extract below is the bit I am unsure about.

Te first line I assume is finding the desired Tag Set but what does the second line do?

My concern is the Erase part of the expression as I don't wish to erase any existing data.

As you will have guessed I am new to this and would appreciate any help.

Is there a reference for MicroStation related commands that I am yet to find?

If eleTag.TagSetName = "RT_Title_A0_A1_A2" Then
         eleTag.Redraw msdDrawingModeErase

Thanks

Bill

tooltips in Microstation

$
0
0

Is there anyway to custom the 'tooltips' such as are displayed with element selection.

To hover over an element and display some customized  'tooltip'.

Project points to the surface?

$
0
0

Dear all,

               I am using Microstation v8i(ss3) with VBA. I have points inside the Non co-planar shape, the points are zero elevation i need to project the points to the Non co-planar shape surface.here i attached my dgn and clearly explain it.

Regards,

Karthik M

(Please visit the site to view this file)

tooltips in Microstation

$
0
0

In Microstation 8.11.09.829 and c# in an AddIn

I tried the following code to generate a tooltip at a screen coordinate.

pushing from 0,0 to 1000,1000 by 100 increments, the tooltip always displays at the upper left corner of the primary screen.

void testDrive()
     {
         BIM.Point2d pG = new BIM.Point2d();
 
         for (double x = 0; x < 1000; x += 100)
         {
             for (double y = 0; y < 1000; y += 100)
             {
                 pG.X = x;
                 pG.Y = y;
 
                 ShowBaloon(pG);
             }
         }
     }
 
     void ShowBaloon(BIM.Point2d p)
     {
         string msg = "AAA" + Environment.NewLine;
         msg += "AAA" + Environment.NewLine;
         msg += "AAA" + Environment.NewLine;
 
         string title = "HOWDY";
 
         mdlWindow_showBalloonTooltip(
                                     msg.ToCharArray(),
                                     0,
                                     title.ToCharArray(),
                                     ref p,
                                     0,
                                     500,
                                     0,
                                     0,
                                     0,
                                     0
                                     );
     }

What am I doing wrong?



using mdlText_create to generate datafields

$
0
0

Hello, I'm trying to alter existing text into datafields using the command below.  If I leave textEdP as NULL, I can write underscores to the design file in the array dataString, but they are line strings and are un-editable.  I cannot figure out how to configure textEdP properly to enable me to  place a 40 char datafield.  Based on the structure in the mdl.h edField is a pointer, but when I try to use (as shown below) it errors and says it can't dereference a non pointer.  

the individual elements in the TextEDField structure are "byte" and there seems to be no documentation how to configure this for my  purposes.

TextEDParam txtEdP;

textEdP.numEDFields = 1;
//textEdP->edField.just = 1;
//textEdP->edField.len = 50;
//textEdP->edField.start = 1;

mdlText_create(&mytext,NULL,dataString,&XYcoord,&mytextsize,NULL,&mytextparam,&textEdP);    <-- how do I configure textEdP to place datafields???

mdlElement_rewrite(&mytext,NULL,elmaddr[jk]);

Thank You

John

Viewing all 4331 articles
Browse latest View live


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