Sie sind auf Seite 1von 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

berk.baki@crh.be

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

Das könnte Ihnen auch gefallen