start up macro

MicroStation V8 XM Edition

This is where you can find and contribute to discussions, ideas, and other information about MicroStation V8 XM Edition.

start up macro

  • rated by 0 members
  • This post has 11 Replies |
  • 1 Follower
  • I should have known it was there.  I had looked in the vba folder but not in that folder.  I usually know where things like that are if they exist.   

     I assumed it wasn't a part of my installation because I don't have the /.../mdl/include/ folder with data to build mdl's.   I was looking in there for the xm version of cmdlist.h so that i could look at commands.   i know that they display in the key-in window but there are some commands that do not.

  • VBA Documentation

    Harry:
    I don't have any VBA documentation to refer to to be able to even try start learning.

    Maybe I ought not to let you know this, but you will find the MicroStation VBA Help file already on your computer.

    Regards, Jon Summers
    LA Solutions

  • I have no experience at all with any sort of programming other than recording commands to build my start up macro.  As far as the documentation that you reference, I don't have any vba documentation to refer to to be able to even try start learning. 

     

  • harryb1120.mvba

    You will find the previous suggestions of using VBA to be MUCH better for you (now, and in the long run). Although you may not have much experience with VBA, if you have experience using MicroStation BASIC, you should be able to pick up VBA relatively quickly (and most likely will never miss MicroStation BASIC :).

    Attached is a macro project that you can use as a start for the specific results that you are looking for, it was taken straight from the VBA documentation under the topic "Setting Coordinate Readout Values". To automatically run that when MicroStation starts, check out the VBA documentation for "autoload".

  • start.bas

    Attached is the macro i am trying to modify.  

    i also tried to record a vba and was able to get the angle portion (dd mm ss, bearing, accuracy set to 0 secs) but not able to set linear accuracy to 2 decimal places. 

     

    Also I have no vba programming experience.   So that limits me to piecing things together using the recorder method.

     

     

  • There is an alternative where you can use...

    Sub SetCoordinateReadout()

    With ActiveSettings
    .CoordinateFormat = msdWorkingUnits
    .CoordinateAccuracy = msdAccuracy8th
    .AngleFormat = msdFormatGradians
    .AngleMode = msdAngleModeBearing
    .AngleAccuracy = msdAngleAccuracy3
    End With

    ' Save these settings back to the file
    CadInputQueue.SendCommand "Save Settings"
    End Sub

     

    Add the above procedure to be called by your 'Sub OnProjectLoad' procedure.

    To find out the other settings for Units, Angles and Bearings check out ActiveSettings in VBA Help Doco's..

    If you have something specific post a response and I'll change the code here to suit...

    Save Settings should always follow to forge the settings into your DGN file...

    ®

  • Sorry Harry, misread your post and put up the keyin for setting working units.

    Have you tried to record a macro yet? This will give you the lines to set accuracy and format:

    MbeSetAppVariable "DGNSET", "dgnSet.angleReadoutPrec", 1&

    MbeSetAppVariable "DGNSET", "dgnSet.anglefmt", 1&, 255&

    I haven't been able to get Linear Unit accuracy as yet.

    As far as VBA goes, if you have a play you'll find it is very similar in many of the basic functions and the record option does help a lot. The output from VBA record was:

    lngTemp = Not 255
    lngTemp = GetCExpressionValue("dgnSet.anglefmt", "DGNSET") And lngTemp
    SetCExpressionValue "dgnSet.anglefmt", lngTemp Or 2, "DGNSET"

    SetCExpressionValue "dgnSet.angleReadoutPrec", 2, "DGNSET"

    It's worth creating a dummy project you can play with this sort of thing. It's a start.

  • Jon, VBA macro recorder works on setting the DDMMSS, bearing and accuracy but does not work on the linear accuracy.   I don't have any experience with VBA but the recorder did a portion of what i need.   Since I have no VBA background I have been able  to cobble together a basic macro and use it prompted by MS_DGNAPPS > runmacro.ma  &  MS_DGNMACROS = start.ba

    Roland, I am using FDOT (Florida Dept of Trans) seed files.  I don't want to change them.  Also a couple of the things i am doing are personal preferences, like setting the measure dialog to perpendicular with "segement only" checked on.

    Bear, I could not find any help topic to use "set units __".  I am not sure if that will help me set linear accuracy.

     

    Thanks for all help!

  • http://www.la-solutions.co.uk/content/mvba/images/imgMacroRecord.jpg
    Harry:
    I need to be able to add some settings to a start up macro.

    Make sure that you use the VBA macro recorder and not the older BASIC recorder. VBA is more capable than BASIC.

    Harry:
    I suspect it may be handled thru calculat.ma but I am not sure how to do that.

    calculat.ma is great for one-liners, but if you want to assign multiple settings then VBA is a better bet.

    Post further questions to the VBA Forum for your version of MicroStation.

    Regards, Jon Summers
    LA Solutions


  • I understand what you are doing but, would it not be easier just to create a seed file with all the setting. Then use that seed file to create a new dgn file.

     Just a thought, Roland

  • You can use keyins like 'set units <master unit>' and go down that route, but, as has been pointed out to me, you may want to try the vb record function and see if you get some more information.

    HTH.

  • I need to be able to add some settings to a start up macro.  I have captured some things using the create macro utility but I can not get it to pick up anything from the Settings > Design File > Working Units.  I want to set angles to dd mm ss; bearing; accuracy of 0 and linear units accuracy to 2 decimal  places.

     

    I suspect it may be handled thru the calculat.ma but I am not sure how to do that.

Page 1 of 1 (12 items)