Maxsurf Modeler Advanced Automation: TransformAdvanced doesn't work

Hi, I'm student and I'm using Maxsurf Modeler Advanced Automation for my thesis. 

I'm trying to do a TransformAdvanced of my model (using Python) but it doesn't work, and in VBA example or in Manual Modeler Automation there isn't this example function.

Now what I write in my code is:

msApp.Design.Hydrostatics.InitAdvancedTransform
a=bool(msApp.Design.Hydrostatics.SetTargetLWL(4.6))
b=bool(msApp.Design.Hydrostatics.SetTargetBeam(1.1))
c=bool(msApp.Design.Hydrostatics.SetTargetPrismatic(0.6))
print(a,b,c)
msApp.Design.Hydrostatics.AdvancedTransform

Then the terminal return a: False, b:False, c:False so the SetTargets don't work.

Can you help me to solve this?

Thanks, 

Simone

Parents
  • here is the sequence that is required:

    Design.Hydrostatics.Calculate                         <<< calculate the hydrostatics for the model
    Design.Hydrostatics.InitAdvancedTransform   <<< initialise the transform
    Design.Hydrostatics.SetTargetPrismatic(0.65) <<< set the target value; this must be achievable for the specific model
    Design.Hydrostatics.AdvancedTransform        <<< perform the transform
    Design.Hydrostatics.Calculate                         <<< recalculate the hydrostatics for the modified hullform
    Design.Hydrostatics.Cp                                   <<< check we got the prismatic we were after

    in VBA in Excel, please try something like this ...

    Sub createModel()

    modelerApp.Design.Surfaces.Add (msSLSimpleYacht)
    modelerApp.Design.FrameOfReference.Baseline = modelerApp.Design.FrameOfReference.FindBase
    modelerApp.Design.FrameOfReference.AftPerp = modelerApp.Design.FrameOfReference.FindAftDWL
    modelerApp.Design.FrameOfReference.FwdPerp = modelerApp.Design.FrameOfReference.FindFwdDWL
    modelerApp.Design.FrameOfReference.VertDatum = msVDTBaseline
    modelerApp.Design.FrameOfReference.LongDatum = msLDTMidships

    End Sub

    Sub MakeTransform()

    Dim val As Double

    modelerApp.Design.Hydrostatics.Calculate
    val = modelerApp.Design.Hydrostatics.Displacement
    Range("A1").Value = "Hydrostatics.Displacement"
    Range("B1").Value = val


    val = modelerApp.Design.Hydrostatics.Cp
    Range("A7").Value = "Hydrostatics.Cp"
    Range("B7").Value = val


    modelerApp.Design.Hydrostatics.InitAdvancedTransform
    Range("A8").Value = "Hydrostatics.InitAdvancedTransform, SetTargetPrismatic"
    Range("B8").Value = 0.65
    Call modelerApp.Design.Hydrostatics.SetTargetPrismatic(0.65)
    modelerApp.Design.Hydrostatics.AdvancedTransform

    modelerApp.Design.Hydrostatics.Calculate
    val = modelerApp.Design.Hydrostatics.Cp
    Range("A9").Value = "Hydrostatics.Cp"
    Range("B9").Value = val


    End Sub

      

    note that the COM interface can be sensitive to timings, you may need to pause while licensing initializes, for the application to start and also allow time for model to load etc.

Reply
  • here is the sequence that is required:

    Design.Hydrostatics.Calculate                         <<< calculate the hydrostatics for the model
    Design.Hydrostatics.InitAdvancedTransform   <<< initialise the transform
    Design.Hydrostatics.SetTargetPrismatic(0.65) <<< set the target value; this must be achievable for the specific model
    Design.Hydrostatics.AdvancedTransform        <<< perform the transform
    Design.Hydrostatics.Calculate                         <<< recalculate the hydrostatics for the modified hullform
    Design.Hydrostatics.Cp                                   <<< check we got the prismatic we were after

    in VBA in Excel, please try something like this ...

    Sub createModel()

    modelerApp.Design.Surfaces.Add (msSLSimpleYacht)
    modelerApp.Design.FrameOfReference.Baseline = modelerApp.Design.FrameOfReference.FindBase
    modelerApp.Design.FrameOfReference.AftPerp = modelerApp.Design.FrameOfReference.FindAftDWL
    modelerApp.Design.FrameOfReference.FwdPerp = modelerApp.Design.FrameOfReference.FindFwdDWL
    modelerApp.Design.FrameOfReference.VertDatum = msVDTBaseline
    modelerApp.Design.FrameOfReference.LongDatum = msLDTMidships

    End Sub

    Sub MakeTransform()

    Dim val As Double

    modelerApp.Design.Hydrostatics.Calculate
    val = modelerApp.Design.Hydrostatics.Displacement
    Range("A1").Value = "Hydrostatics.Displacement"
    Range("B1").Value = val


    val = modelerApp.Design.Hydrostatics.Cp
    Range("A7").Value = "Hydrostatics.Cp"
    Range("B7").Value = val


    modelerApp.Design.Hydrostatics.InitAdvancedTransform
    Range("A8").Value = "Hydrostatics.InitAdvancedTransform, SetTargetPrismatic"
    Range("B8").Value = 0.65
    Call modelerApp.Design.Hydrostatics.SetTargetPrismatic(0.65)
    modelerApp.Design.Hydrostatics.AdvancedTransform

    modelerApp.Design.Hydrostatics.Calculate
    val = modelerApp.Design.Hydrostatics.Cp
    Range("A9").Value = "Hydrostatics.Cp"
    Range("B9").Value = val


    End Sub

      

    note that the COM interface can be sensitive to timings, you may need to pause while licensing initializes, for the application to start and also allow time for model to load etc.

Children
No Data