Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Campus
UserAssistance
DiscussionForum
Warehouse
Downloads
valentin.chiru@technyx.ws
HiJuan!
AsInoticedthecustomcomponentsaremappedbytheAPIasdetails(instancesofDetailclass),
andhavethenumbersetto1.
FordetailsyouhaveaccesstotheprimaryobjectviatheGetPrimaryObject()method.
IsthereanywaytohaveaccesstothesecondaryobjectsofacustomcomponentviatheAPI?I
seethatthereisnoGetSecondaryObjects()methoddefinedfordetailsasitisfortheConnection
class.
Thankyouforthehelp,
Vali
Post18novembre200911:12
JuanRodriguez
HiVali,
AsIunderstand,detailscanonlyhaveaprimarypartintheAPI,notsureifyoucanmodela
detailwithsecondariesthough.SothereisnopointinhavingaGetSecondaryObjectsmethodfor
detailswhenyoucannotsetthem,atleastintheAPIisnotsupported.
Bestregards,
Post18novembre200911:22
valentin.chiru@technyx.ws
I'minterestedonlytogetthesecondariesforadetail,nottosetthem.Thesecondariesaresetvia
theuserinterface,whentheuserinsertsacustomcomponentintothemodel.Theuserselects
theprimaryandthesecondaryobjectsforthecustomcomponentandinsertsitintothemodel.
Thiscustomcomponentthatrequiresaprimaryandsomesecondaryobjectsfromtheuserat
inserttime,ismappedwiththeAPIintoadetailobject.
Thequestionwasifthereisanywaytogetthesecondaryobjectsforthedetailalso,astheuser
couldnotinsertthecustomcomponentintothemodelinthefirstplacewithoutsettingthem.
Post18novembre200911:48
JuanRodriguez
ButisitactuallyaDetail?oraComponent?IwonderifyoucancastitasComponentinthe
API...Thenyoucouldgetthesecondaries.
valentin.chiru@technyx.ws
Post18novembre200911:59
Unfortunatellyit'sadetail. AndIdon'tseehowtocastittoacomponent.Itwillthrowmean
InvalidCastException.
Post18novembre200912:07
JuanRodriguez
Canyousendthecomponenttotakealooktoit?Idon'tknowhowyoucanhaveadetailwith
morethanoneinputobjects.
Post18novembre200901:57
valentin.chiru@technyx.ws
Hiagain!
I'vejusttalkedwithmyTeklauseranditseemsthatinorderforausertocreateacustom
connectionhemustchoosethe"Connection"itemastypeinthe"CustomConnectionWizard".
CanyouconfirmthatalltheconnectionsdoneinthiswaywillbemappedasConnectionclass
instanceswiththeAPI?
Sorryfortheinitialconfusion...TheobjectthatItestedtheAPIwith,wasadetailindeed,butI'm
interestedincustomconnectionsinparticularandnotcustomcomponentsingeneral.
Regards,
Vali
Post18novembre200902:12
JuanRodriguez
HiVali,
CustomconnectionsshouldappearasConnectionintheAPI,I'veuseditsomeprevioustimes
withoutanyproblem,asIrecall.
Asyouknow,inconnectionyoucanusetheGetSecondaryObjects()method.
Bestregards,
Post18novembre200902:16
valentin.chiru@technyx.ws
ThankyouJuan!
That'sgreatnews!
Post12mai201009:13
JohnNorbury
Howcanyoumodifyonlysecondarypartsandnotmainparts?
Post12mai201011:04
JuanRodriguez
JustuseGetSecondaryObjects()togetthesecondaries,gettheoneyouwanttomodifyand
modifyit.Thatdoesn'taffectmainparts.
Bestregards,
Post13mai201002:06
JohnNorbury
Buthowcanyoudothiswithoutbeinginaconnection?Justsecondarypartsinthemodel.
I'vebeentryingB.GetAssembly().GetSecondaries()likeso:
TSM.ModelObjectEnumeratorP=M.GetModelObjectSelector().GetSelectedObjects()
if(P.GetSize()>0)
{
while(P.MoveNext())
{
TSM.PartB=P.CurrentasPart
B.GetAssembly().GetSecondaries()
if(B!=null)
{
B.PartNumber.Prefix=textBox3.Text
B.AssemblyNumber.Prefix=textBox4.Text
B.Modify()
}
}
M.CommitChanges()
}
InanothercodeIusethislineforgettingmainpartsanditworks:
TSM.PartA=B.GetAssembly().GetMainPart()asPart
Butitwon'tletmeturnB.GetAssembly().GetSecondaries()intoaPartasit'sanarraylist.How
canIdothis?
P.S.Iprobablyshouldhavemadeanewthreadforthis.Sorry
Post14mai201009:24
JuanRodriguez
HiJohn,
WhenyouuseGetSecondariesyouneedtostoretheminanArrayListandthenmodifiedtheone
youwant,theremightbeseveralsecondaries.
Inthenextexampleisgettingthefirstsecondaryofaconnectionorassemblyandmodifyingits
PartNumber.Prefix.Notethatforassembliesandconnectionsthemethodstogetthesecondaries
aredifferent.ProbablythiscouldbemorenicelyputusingdelegatesbutIwon'tgointothat .
Youcodeshouldlookalittlemorelikethis:
PickerPicker=newPicker()
ModelObjectModelObject=Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT)
if(ModelObjectisTSM.Connection)
{
TSM.ConnectionConnection=ModelObjectasTSM.Connection
ArrayListSecondaries=Connection.GetSecondaryObjects()
BeamBeam=(Beam)Secondaries[0]
if(Beam!=null)
{
Beam.PartNumber.Prefix="J"
Beam.Modify()
}
}
elseif(ModelObjectisAssembly)
{
AssemblyAssem=ModelObjectasAssembly
ArrayListSecondaries=Assem.GetSecondaries()
BeamBeam=(Beam)Secondaries[0]
if(Beam!=null)
{
Beam.PartNumber.Prefix="J"
Beam.Modify()
}
M.CommitChanges()
Ihopethishelps.
Bestregards,
Post17mai201007:04
JohnNorbury
HiJuan,whatdoIneedtoreferencetogetArrayListworking?ItjustunderlinesitinredandI
can'tworkitout.....youcanjusttellI'manoob
EDIT:Aftersearchingthough13+pagesIfinallyfoundithaha.System.Collections.ArrayList
EDIT2:Istillcan'tgetit.Iamtryingthiscode.Whatswrongwithit?
TSM.ModelObjectEnumeratorP=M.GetModelObjectSelector().GetSelectedObjects()
if(P.GetSize()>0)
{
while(P.MoveNext())
{
TSM.ModelObjectA=P.CurrentasTSM.ModelObject
if(AisTSM.Connection)
{
TSM.ConnectionConnection=AasTSM.Connection
System.Collections.ArrayListSecondaries=Connection.GetSecondaryObjects()
BeamB=(Beam)Secondaries[0]
if((B!=null)&&((B.Name!="TREAD")||(B.Name!="TURNBUCKLE")))
{
B.PartNumber.Prefix=textBox3.Text
B.AssemblyNumber.Prefix=textBox4.Text
B.Modify()
}
}
elseif(AisAssembly)
{
AssemblyAssem=AasAssembly
System.Collections.ArrayListSecondaries=Assem.GetSecondaries()
BeamB=(Beam)Secondaries[0]
if((B!=null)&&((B.Name!="TREAD")||(B.Name!="TURNBUCKLE")))
{
B.PartNumber.Prefix=textBox3.Text
B.AssemblyNumber.Prefix=textBox4.Text
B.Modify()
}
}
}
M.CommitChanges()
Post17mai201008:56
TobiasSvenberg
IfyouareusingVisualStudiothereisaneasywaytofindtheproperreferenceforcommon
itemssuchasArrayList.
simplydefineanewArrayListlikeso:
ArrayListmyList=newArrayList()
(Notethatitwillnotshowupinthescrolllistsoyouwillneedtotypetheentireline).
ThislinewillbehighlightedbyVisualStudioascontaininganerror.Nowtothefinding
referencepart.
rightclickonthelineinyourcodeanduse"resolve"
Post18mai201001:23
JohnNorbury
AhhhIsee,ThanksTobias!
Anyideaswhat'swrongwithmycode?
Post18mai201009:47
JuanRodriguez
HiJohn,
Yourcodeisworkingnicely ,please:
...checkthatyouhaveselectedthecorrectitems.
...debugyourcodeinordertoseeiftheenumeratorisemptyornot.Andalsoifthecode
goesinsidetheifclauses.
...checkthatyouhave"Selectcomponents"active,not"Selectobjectsincomponents".
...makesurethatyouareusingthereferencesneededbyyourcodeintheproject,also
remembertoaddthe"using"inthebeginningofyourcsfile,e.g.usingSystem.Collections
Bestregards,
Post19mai201009:09
JohnNorbury
IthinkyoumayhavemisunderstoodwhatI'mtryingtodoasthiscodeisnotdoingwhatIwant.
AllIwanttodoismodifysecondarypartslikethisweldedcleathereoranythingelseweldedto
thatbeam:
(https://forum.tekla.com/uploads/old/0ca39dd78e614ebba91903c816c24bb7.PNG)
Post19mai201009:16
JuanRodriguez
Citation
Anyideaswhat'swrongwithmycode?
Youaskthat,soItestedyourcodeanditworks.Iwasjusttellingsomereasonswhythecode
mightnotbeworking.Yourcodejustgetsthefirstsecondaryandmodifiestheprefixofassembly
numberandpartnumber,andthatworks.
Ifyouwanttomodifyallthesecondariesandnotjustone,loopthroughthaArrayListreturned
byGetSecondaryObjectsorGetSecondaries.
Post19mai201009:37
JohnNorbury
Yesthecodehasnoerrorsbutitismodifyingoneofthosebeamsandnottheplateeventhough
thebeamisnotasecondary.
Ijustwanttoselectaheapofpartsinthemodelbutonlymodifythesecondarypartsitfinds.
Page1sur2
RetournerdansGeneraldiscussionsProchainsujetnonlu
Nous contacter
Facebook
TwitterLinkedIn
YouTube
Tekla France:
ZAAlbiple
8AvenueAlbiple
81150Terssac
France
Tlphone:+3356348
1160
TeklaWebsite
TeklaCampus
TeklaUserAssistance
TeklaDiscussionForum
TeklaWarehouse
TeklaDownloads
Tlcopie:+3356348
1161
Conditionsgnrales Utilisationlgaledeslicences Politiquedeconfidentialit
TeklaestuneentrepriseTrimbleCopyright2015TeklaCorporation