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

RE: Passing in Point3D with late binding

$
0
0

To summarize VBA does not seem to like doing stuff with UDT's:

Trying to pass as dynamic array

Dim latePoint3d() As Double

ReDim latePoint3d(0 To 2)


elSphere.Move latePoint3d                     ' Type mismatch

Call elSphere.Move(latePoint3d)            ' Type mismatch

 

Trying to pass as static array

Dim latePoint3d(0 To 2) As Double

elSphere.Move latePoint3d                     ' Type mismatch

Call elSphere.Move(latePoint3d)            ' Type mismatch

 

Trying to pass as public UDT defined in sub

Will not compile (Invalid inside procedure)

 

Trying to pass as public UDT defined in form outside sub

Will not compile (Cannot define a Public udt within an object module)

 

Trying to pass as private UDT defined in form outside sub

Gives error "Only user-defined types defined in public object modules can be coerced to or form a variant or passed to late-bound functions"

 

Trying to pass as UDT defined in main module

Gives error "Only user-defined types defined in public object modules can be coerced to or form a variant or passed to late-bound functions"

 

Trying to pass as UDT defined in ThisWorkbook

Will not compile (Cannot define a Public udt within an object module)

 

Suggetions around the web is to create the UDT as a class.

Class setup:

(Class module cMSPoint3D, set as the default Private)

Option Explicit

Public X As Double

Public Y As Double

Public Z As Double

And in the form I have:

Dim latePoint3d As New cMSPoint3D

Dim sphereSize As Double

Dim elSphere As Object
    

    sphereSize = 24.5

    latePoint3d.X = 100.5

    latePoint3d.Y = 200.5

    latePoint3d.Z = 300.5


    Set elSphere = objMSApp.SmartSolid.CreateSphere(Nothing, sphereSize)

    Call elSphere.Move(latePoint3d)

    objMSApp.ActiveModelReference.AddElement elSphere

 

Gives Run-time error: A property or method call cannot include a reference to a private object, either as an argument or as a return value.

 

Changing the class type to the only avaliable alterative:

(Class module cMSPoint3D, set as PublicNotCreatable)

Gives type mismatch

 

I am at my witts end. The only other thing I can think of to try, is to see if there is som function I can call which returns a point3d (ex. returnPoint3d(xcoord, ycoord, zcoord))


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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