0% found this document useful (0 votes)
234 views4 pages

How Can I Select An Object in Tekla and Get Its Info - General Discussions - Tekla Discussion Forum PDF

I want to select an object in Tekla and get its info by c# code. I already created some objects in Tekla by C# code input. Do you know the ID of the object? in that case: new Model().SelectModelObject(new Identifier(myPartID)) as Part?

Uploaded by

Đào Hải Nam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
234 views4 pages

How Can I Select An Object in Tekla and Get Its Info - General Discussions - Tekla Discussion Forum PDF

I want to select an object in Tekla and get its info by c# code. I already created some objects in Tekla by C# code input. Do you know the ID of the object? in that case: new Model().SelectModelObject(new Identifier(myPartID)) as Part?

Uploaded by

Đào Hải Nam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TeklaWebsite

Campus

UserAssistance

DiscussionForum

Warehouse

Downloads

TeklaDiscussionForum TeklaStructuresOpenAPIForums Generaldiscussions

How can I select an object in Tekla and get its info?


DbutparKristofVanVlasselaer,fvr.07201412:07

Post07fvrier201412:07

KristofVanVlasselaer

Hello,
i'mjuststartingwithOpenAPIinTekla&VisualStudioC#.

IalreadycreatedsomeobjectsinTeklabyC#codeinput.LearnedformnextURL:(

ButIwanttoknowhowyoucandoitintheotherway.
IwanttoselectanobjectinTeklaandgetitsinfo(ex."Profile")byC#code.
Doyouhaveasimpleexamplecodeofthis?

Thanksinadvance!

Greetings,
Kristof.

Post07fvrier201412:11

Carlos

Hello,
DoyouknowtheIDoftheobject?Inthatcase:
PartmyPart=newModel().SelectModelObject(newIdentifier(myPartID))asPart
stringmyPartProfile=myPart.Profile.ProfileString
Regards,
Post07fvrier201412:40

KristofVanVlasselaer

HiCarlos,
Itrieditoutanditworkedperfectly.

PartmyPart=newModel().SelectModelObject(newIdentifier(575))asPart
stringmyPartProfile=myPart.Profile.ProfileString
MessageBox.Show(myPartProfile)

ButwhatIreallywanttoaccomplishisthat
1.Irunaparticularcode(anditopensautomaticallyinTekla)
2.Iselectanobject
3.Thecodegivesmebackthe"Profile"stringwithaMessageBox
SoIwanttoknowhowIcanselectanobjectwithoutmanuallytypein575likeintheexample.
WhenIselecttheobject,thecodealreadyshouldknowtheID...
IfyouknowwhatImean

Greetings,
Kristof.
Post07fvrier201401:34

KristofVanVlasselaer

I'mthinkingofa"WAITFORUSERINPUT"functiontoselectanobjectinthemodel?

PartmyPart=newModel().SelectModelObject"WAITFORUSERINPUT"asPart
stringmyPartProfile=myPart.Profile.ProfileString
MessageBox.Show(myPartProfile)

ItisthesamewayofactingwhenyouforexampleuseTekla's"FIT"or"TRIM"function.
1.Youpushthe"FIT"or"TRIM"button(code)
2.Youselectanobject
3.Thecodecontinues...

HopefullyImadeitabiteasiertounderstand
Greetings,
Kristof.
Post07fvrier201401:40

Carlos

Hello,
YoucanuserPickerclassandthenyoudon'tneedtousehardcodedvalueforID:
PickermyPicker=newPicker()
PartmyPart=myPicker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART)asPart
stringmyPartProfile=myPart.Profile.ProfileString
Regards,
Post07fvrier201403:07

KristofVanVlasselaer

Carlos,
thanksman!That'swhatI'mtalkingabout\o/
Seeyousoon

Greetings,
Kristof.

Post01avril201402:46

[email protected]

publicclassXX
{
publicstaticTM.UI.PickerGetPicker
{
get
{
returnnewTM.UI.Picker()
}
}
///<summary>
///Selectionofobject(s)
///</summary>
publicstaticTM.ModelObjectPickObject
{
get
{

return
GetPicker.PickObject(global::Tekla.Structures.Model.UI.Picker.PickObjectEnum.PICK_ONE_O
BJECT,
"PleasePickanObject")
}
}
}
varpickedObject=XX.PickObjet

RetournerdansGeneraldiscussionsProchainsujetnonlu

TeklaDiscussionForum TeklaStructuresOpenAPIForums Generaldiscussions

Nous contacter
Tekla France:
ZAAlbiple
8AvenueAlbiple
81150Terssac
France
Tlphone:+3356348
1160

TeklaWebsite
TeklaCampus
TeklaUserAssistance

TeklaDiscussionForum
TeklaWarehouse
TeklaDownloads

Tlcopie:+3356348
1161
Conditionsgnrales Utilisationlgaledeslicences Politiquedeconfidentialit
TeklaestuneentrepriseTrimbleCopyright2015TeklaCorporation

Facebook
TwitterLinkedIn
YouTube

You might also like