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?
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 KarProduct 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.
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?
As per our understanding, you are creating a plate using PsCreatePlate class as shown below
Dim KsCreatePlate As New Bentley.ProStructures.Steel.Plate.PsCreatePlateKsCreatePlate.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 BooleanResult = 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 objectDim 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 checkingFinally 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.
Answer Verified By: Bingle smith
Thank you very much,I have get this plate information