I am chinese user, I want to ask secondary development of prostructures question by addin

How to get PsCreatePlate creating object's PsShapeInfo?

I see Prostructures devlopment document, I can use PsSelection class get objectid ,then use objectid to get PsShapeInfo,but Idon't want use selection.what shoud i do?

Parents
  • Hello Bingle Smith,

    Thanks for posting this query in Bentley Community Forum.
    Can you please elaborate more on this so that we can look into this and can help you?

    Regards,
    Sandip Kar
    Product Engineer - Bentley Systems

  • I want to secondary development in prostructure by CSharp_addin method,I have created a plate by PsCreatePlate.Create() method , then,I want to get this plate's info by code,what shoud i do?

  • Hi Bingle,

    Can you check with the following code to get your result?

    ***

    Result = CreatePlate.Create

    // After creating plate you can do the following

     

    Dim PlateId As Long = 0 // Declaration of the variable at beginning of code

     

    If Not Result Then

       PlateId = 0

    Else

       PlateId = CreatePlate.ObjectId

    End If

    Please do let us know if this resolves your issue or not.

    Regards,
    Sandip Kar
    Product Engineer - Bentley Systems

  • I've tried to use PsCreatePlate's objectid,Then I  have gived this objectid to PsShapeInfo's SetObjectId method's parameter ,this way is not useful。what should I do to get this plate‘s information?

  • Hi Bingle,

    As per our understanding, you are creating a plate using PsCreatePlate class as shown below

    Dim KsCreatePlate As New Bentley.ProStructures.Steel.Plate.PsCreatePlate
    KsCreatePlate.SetInsertMatrix(KsMatrix) // setting some matrix from model
    ..
    KsCreatePlate.SetAsRectangularPlate(Width, Height) // setting width and height
    ..
    KsCreatePlate.SetThickness(10.0) // setting thickness
    ..
    KsCreatePlate.SetMaterial(MaterialIndexFromName(Data.PlateMaterial)) // setting material
    ..
    Dim Result As Boolean
    Result = KsCreatePlate.Create // To generate the plate

    Now we assume, you want to read the generated plate info may be to do some modifications or to set some new parameters. But you are not able to do the same unless you select the same plate in the model and you don't want to select the plate. Please correct me, if I am not understanding it properly.

    In the above case, if the you do not want to select the plate, you must use the ID of the plate (shape) to access the existing / generated plate info. Refer below sample code

    Dim oTran As New PsTransaction // PsTransaction class is must to read the any object
    Dim rtnPlate As PsPlate = Nothing
    Try
    oTran.GetObject(mPlateId, PsOpenMode.kForRead, rtnPlate)
    // mPlateId -> Plate ID to be supplied by user (programmatically – store while generating )
    // PsOpenMode.kForRead -> read and write mode depends on whether user want only to read the plate or also want to modify
    // rtnPlate -> all plate parameters will be available with this object

    Catch ex As Exception // Error checking
    Finally
    oTran.Close()
    End Try

    As per .Net help file…Below is the syntax

    System::Boolean Bentley::ProStructures::Drawing::PsTransaction::GetObject ( System::Int64 Id,
    ProStructures::PsOpenMode
    Mode,
    Steel::Plate::PsPlate^ %
    entObject,
    bool bUseErasedObject
    )

    I hope this helps. Do let me know in case of any further information needed.

    Regards,
    Sandip Kar
    Product Engineer - Bentley Systems

    Answer Verified By: Bingle smith 

  • Thank you very much,I have get this plate information 

Reply Children
No Data