MicroStation visual interface of VBA

Source: Internet
Author: User

Tenth Chapter Visual Interface

Private Subuserform_initialize ()DimViewcen asPoint3DDimMyView asView for  eachMyViewinchActiveDesignFile.ViewscmbViews.AddItem Myview.indexNextCmbviews.listindex=0Viewcen= Activedesignfile.views (1). Centerscrx.value=ViewCen.XscrY.Value=VIEWCEN.YEnd SubSubSetzoom (Zoomvalue as Long, Oldzoomvalue as Long) activedesignfile.views (Cmbviews.text). Zoom1+ (Zoomvalue-oldzoomvalue)/ -activedesignfile.views (Cmbviews.text). RedrawEnd SubSubSetpan (XPan as Long, Ypan as Long)DimVieworigin aspoint3dvieworigin.x=XPANVIEWORIGIN.Y=ypanvieworigin.z=0activedesignfile.views (Cmbviews.text). Center=vieworiginactivedesignfile.views (Cmbviews.text). RedrawEnd SubPrivate Subscrzoom_change () setzoom scrzoom.value, ScrZoom.TagScrZoom.Tag=Scrzoom.valueEnd SubPrivate Subscrzoom_scroll () setzoom scrzoom.value, ScrZoom.TagScrZoom.Tag=Scrzoom.valueEnd SubPrivate Subscrx_change () Setpan scrx.value, Scry.valueEnd SubPrivate Subscrx_scroll () Setpan scrx.value, Scry.valueEnd SubPrivate Subscry_change () Setpan scrx.value, Scry.valueEnd SubPrivate Subscry_scroll () Setpan scrx.value, Scry.valueEnd Sub

This chapter reviews:

1. All spaces have properties, methods, and events

2. The format of the properties and methods of the access space are: space name, a dot number, properties and methods, provide parameters when needed

3. When the program runs, the interaction between the user and the interface triggers events

4. Show user forms with Show method

5. Use the Initialize event to set values and add controls before the window is displayed

The 11th Chapter MicroStation object Model--object

Provides the object model of the library, the Object Browser in VBA is most helpful, and VBA also includes other tools that can help you develop, such as adding monitoring and automatic list features

The 12th Chapter MicroStation Object Model--Enumeration enumeration

Advantages of enumerations: it is easier to see the results of the required parameters when parsing the code.

Enumeration member names often begin with an enumeration name or an abbreviated version of an enumeration name. For example, MSDDESIGNFILEFORMATDWG is the beginning of the enumeration name "Msddesignfileformat".

All enumerations in MicroStation begin with the specified three-character "MSD", and all members begin with "MSD"

14th Chapter MicroStation Object Model--event

Objects have methods, properties, and events.

P259

P155

15th. Adding content to a document

Use a colon (:) put two lines of code on one line. Placing the same vertex assignment on one line also increases the readability of the Code

SubCreatelines ()DimLinePoints1 (0  to 3) asPoint3DDimLinePoints2 (0  to 3) asPoint3DDimMyLine1 aslineelementDimMyLine2 aslineelementDimI as Long forI =0  to 3 Step 1LinePoints1 (I). X= I ^3-I ^2: LinePoints1 (I). Y = i + I ^2LinePoints2 (I). X= I ^3-I ^2: LinePoints2 (I). Y =-(i + I ^2)NextISetMyLine1 = CreateLineElement1 ( Nothing, LinePoints1)SetMyLine2 = CreateLineElement1 ( Nothing, LinePoints2) Activemodelreference.addelement myline1activemodelreference.addelement MyLine2End Sub

SubClines (ParamArrayPointelems () asVariant)If(UBound(Pointelems) +1)Mod 3<>0  ThenMsgBox "invaid Number of point elements", vbcriticalExit SubEnd IfIf(UBound(Pointelems) +1) <5  ThenMsgBox "A Minimum of 2 x, Y, Z points must be provided.", vbcriticalExit SubEnd IfDimLinepoints () asPoint3DReDimLinepoints (0  to(UBound(Pointelems) +1) \3) asPoint3DDimI as LongDimPointcounter as LongDimMyline aslineelement forI =LBound(Pointelems) to UBound(Pointelems)Step 3linepoints (pointcounter). X=Pointelems (I) linepoints (pointcounter). Y= Pointelems (I +1) linepoints (pointcounter). Z= Pointelems (I +2) Pointcounter= Pointcounter +1NextISetMyline = CreateLineElement1 ( Nothing, Linepoints) Activemodelreference.addelement MylineEnd SubSubtestclines () clines0,0,0,4,0,0,4,4,0,0,4,0,0,0,0Clines0,0,0,4,4,0Clines0,4,0,4,0,0Clines0,4,0,4,0Clines0,4,0End Sub

Build shape

FunctionCreatepolygon (CenterPoint asPoint3D, Numofsides as Long, Radius as Double) asshapeelementDimMyShape asshapeelementDimShapepoints () asPoint3DReDimShapepoints (0  toNumofsides-1) asPoint3DDimPointIndex as LongDimIncangle as DoubleIncangle= the/Numofsides forPointIndex =LBound(shapepoints) to UBound(shapepoints) shapepoints (PointIndex)= Point3daddangledistance (CenterPoint, Radians (Incangle * PointIndex), Radius,0)NextSetCreatepolygon = CreateShapeElement1 ( Nothing, shapepoints)End FunctionSubTestcreatepolygon ()DimCPoint asPoint3DDimMyShape asshapeelementDimI as LongDimLength as DoubleLength=1 forI =3  to  the Step 1SetMyShape =Createpolygon (CPoint, I, length) length= Length +1activemodelreference.addelement MyShapeNextIEnd Sub

DimCPoint asPoint3DDimMyellipse asellipseelementDimRotmatrix asMatrix3DDimInputqueue asCadinputqueueDimIntputmessage asCadinputmessageSetInputqueue =CadinputqueueSetInputMessage =inputqueue.getinput (Msdcadinputtypedatapoint, Msdcadinputtypeany) DoSelect  CaseInputmessage.inputtyoe CaseMsdcadinputtypedatepointcpoint=Inputmessage.pointSetMyellipse = CreateEllipseElement2 ( Nothing, CPoint,0.5,0.5, Rotmatrix) Activemodelreference.addelement MyellipseExit  Do CaseMsdcadinputtyperesetExit  DoEnd SelectLoop

MicroStation visual interface of VBA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.