Вы находитесь на странице: 1из 12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

ThroughtheInterface(http://throughthe
interface.typepad.com/through_the_interface/)
AblogfordevelopersprogrammingwithAutoCADandotherAutodeskplatforms.

April02,2007

AddingXDatatoAutoCADentitiesusing.NET
Afollowupquestioncameinrelatedtothelastpost(http://throughtheinterface.typepad.com/through_the_interface/2007/03/manipulating_th.html),aroundhow
toaddXDatatoentitiesusing.NET.
ExtendedEntityData(XData)isalegacymechanismtoattachadditionalinformationtoAutoCADentities.Isay"legacy"astherearelimitsinherenttousingXData,
whichmakeothermechanismsmoreappropriatewhenstoringsignificantamountsofdata.TheglobalXDatalimitis16KBytesperobject,andthispotentiallyneedstobe
sharedbetweenmultipleapplications.
WithAutoCAD2007camethecompleteswitchtoUnicodeforstringrepresentation,whichincreasesthestoragerequirementsforstringsinXData.Internally,thelimit
hasincreasedtocopewiththis,butbecauseofroundtrippingrequirementswitholderversionsnomoreXDatashouldbestoredthanthepreviouslyrecommendedlimit.
XDataisstillpopularforanumberofreasonsit'ssimpletocodeagainstandisquiteefficientforsmallamountsofdatabutforanysignificantusagethepreferred
mechanismistostoreXRecordsineachobject'sExtensionDictionary,asdemonstratedinthispreviouspost(http://throughthe
interface.typepad.com/through_the_interface/2006/11/linking_circles_1.html).It'salsopossibletoexposeyourowncustomdataobjectsfromObjectARX(C++)to
.NETwithaManagedWrapper,butthat'samuchmoreadvancedtopic.
I'vewrittensomeC#codethatimplementstwocommandsonetoattachsomeXDatatoanentitychosenbytheuser(SXD),andtheothertoaccessanddumptheXData
attachedtoaselectedentitytothecommandline(GXD).
Hereitis:
usingAutodesk.AutoCAD.ApplicationServices
usingAutodesk.AutoCAD.DatabaseServices
usingAutodesk.AutoCAD.EditorInput
usingAutodesk.AutoCAD.Runtime
namespaceExtendedEntityData
{
publicclassCommands
{
[CommandMethod("GXD")]
staticpublicvoidGetXData()
{
Documentdoc=
Application.DocumentManager.MdiActiveDocument
Editored=doc.Editor
//Asktheusertoselectanentity
//forwhichtoretrieveXData
PromptEntityOptionsopt=
newPromptEntityOptions(
"\nSelectentity:"
)
PromptEntityResultres=
ed.GetEntity(opt)
if(res.Status==PromptStatus.OK)
{
Transactiontr=
doc.TransactionManager.StartTransaction()
using(tr)
{
DBObjectobj=
tr.GetObject(
res.ObjectId,
OpenMode.ForRead
)
ResultBufferrb=obj.XData

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

1/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

if(rb==null)
{
ed.WriteMessage(
"\nEntitydoesnothaveXDataattached."
)
}
else
{
intn=0
foreach(TypedValuetvinrb)
{
ed.WriteMessage(
"\nTypedValue{0}type:{1},value:{2}",
n++,
tv.TypeCode,
tv.Value
)
}
rb.Dispose()
}
}
}
}
[CommandMethod("SXD")]
staticpublicvoidSetXData()
{
Documentdoc=
Application.DocumentManager.MdiActiveDocument
Editored=doc.Editor
//Asktheusertoselectanentity
//forwhichtosetXData
PromptEntityOptionsopt=
newPromptEntityOptions(
"\nSelectentity:"
)
PromptEntityResultres=
ed.GetEntity(opt)
if(res.Status==PromptStatus.OK)
{
Transactiontr=
doc.TransactionManager.StartTransaction()
using(tr)
{
DBObjectobj=
tr.GetObject(
res.ObjectId,
OpenMode.ForWrite
)
AddRegAppTableRecord("KEAN")
ResultBufferrb=
newResultBuffer(
newTypedValue(1001,"KEAN"),
newTypedValue(1000,"Thisisateststring")
)
obj.XData=rb
rb.Dispose()
tr.Commit()
}
}
}
staticvoidAddRegAppTableRecord(stringregAppName)
{
Documentdoc=
Application.DocumentManager.MdiActiveDocument
Editored=doc.Editor
Databasedb=doc.Database
Transactiontr=
doc.TransactionManager.StartTransaction()
using(tr)
{
RegAppTablerat=
(RegAppTable)tr.GetObject(
db.RegAppTableId,
OpenMode.ForRead,
false

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

2/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

)
if(!rat.Has(regAppName))
{
rat.UpgradeOpen()
RegAppTableRecordratr=
newRegAppTableRecord()
ratr.Name=regAppName
rat.Add(ratr)
tr.AddNewlyCreatedDBObject(ratr,true)
}
tr.Commit()
}
}
}
}

OnepointtonoteistheneedtoaddaRegisteredApplicationtotheappropriatetableinsidethedrawing.Thenameyouuseforthisshouldbeprefixedwithyour
RegisteredDeveloperSymbol(RDS)(http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1075006),topreventconflictswithotherapplications.
OutfirstweekendinBeijingwasfine.Westartedgently,bysleepinglateandmakingatriptoWalMart,ofallplaces!TheWalMartneartowhereweliveinBeijingis
likeallotherWalMartsI'vevisitedintheUSenormous.OneveryhelpfulthingforuswasthelabellingofallsectionsinbothEnglishandMandarin.Itwasreallyafun
experiencecheckingoutthedifferentproduceandtryingtoworkoutwhatexactlywewerebuying!
AfewkeydifferencestoWalMartsintheUS:
Youcanselectyourfish(andotherfresh/seawaterproduce)fromtanksmuchasyoucaninrestaurantsinSanFrancisco'sChinatown(andpresumablymany
restaurantsinChina,too:).
Youcan'ttakethetrolleyoutofthestore,whethergettingintoyourowncarorintoataxi.Thisposedquitealogisticalchallengeforus,aswehadtwokids(eachwith
strollers)andhadboughtsomebulkitemstolastuswellintoour7weekstay.UltimatelyIsettledonleavingmywifeandkidsoutside,whileImade3tripsupand
downtheescalators,ferryingshoppingbags.
Oh,andIwasalsoalittledisappointedthestorewasn'tcalled"TheGreatWalMart"(groan)
PostedonApril02,2007at07:04AMinAutoCAD(http://throughtheinterface.typepad.com/through_the_interface/autocad/),AutoCAD.NET(http://throughthe
interface.typepad.com/through_the_interface/autocad_net/),Drawingstructure(http://throughthe
interface.typepad.com/through_the_interface/drawing_structure/)|Permalink(http://throughthe
interface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html)
(http://twitter.com/share?url=http%3A%2F%2Fthroughthe
interface.typepad.com%2Fthrough_the_interface%2F2007%2F04%2Fadding_xdata_to.html&text=Adding%20XData%20to%20AutoCAD%20entities%20using%20.NET)
(https://plus.google.com/share?url=http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html)

(http://www.facebook.com/sharer.php?u=http%3A%2F%2Fthroughtheinterface.typepad.com%2Fthrough_the_interface%2F2007%2F04%2Fadding_xdata_to.html)

57Comments

ThroughtheInterface

Recommend

Share

Login

SortbyOldest

Jointhediscussion
NikolayPoleshchuk 9yearsago

WhydoesAutodeskuselegacyxdataforannotationscaling?

Reply Share

KeanWalmsley

Mod 9yearsago

Becauseit'sefficientforsmallamountsofdata(andannotationscalingdoesn'tneedmuchadditionaldatathesameasfortheHyperlinkfeature
inAutoCAD).XDataisfineifyou'restoringuptoaround1KBanythingmorethanthatandI'drecommendExtDicts+XRecords.
Withhindsight,theword"legacy"hassomenegativeconnotations...thepointI'mtryingtomakeisthatitisveryriskytorelyonitforsubstantial
amountsofadditionaldata(>1KBperapp).

Reply Share

NikolayPoleshchuk 9yearsago

Kean,thankyou.ItwouldmoreusualformetogetannotativedatafromordinaryDXFcodes.Xdatamayaccumulatefromvariousapplications.
Canyoushowanexample(inC#orC++)ofaddinganewannotationscaletoanentity?

Reply Share

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

3/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

KeanWalmsley

Mod 9yearsago

Oh,Iseewhatyourquestionis...wecouldn'tgobackandputtheadditionalannotativedataas"standard"groupcodes,asthatwouldinvolvea
changeintheDWG&DXFformatsomethingthatonlyhappensevery3releases(andisn'tdueuntilthereleaseafternext).
Iwilladdanannotativescalingsampletomytodolistfortheblog...(youshouldchecktheoneontheObjectARXSDKinthemeantime.)

Reply Share

Wyatt 9yearsago

YouforgottodisposeofyourResultBuffersinbothyourabovecodesamples.IthasbeenmyexperiencethatfailingtodisposeofaResultBuffer
willcauseAutoCADtorandomlygoBOOMatsomelatterpointwhenaccessingXData.

Reply Share

KeanWalmsley

Mod 9yearsago

Thefinalizershouldhandletheunderlyingresources'disposalbutyouneverknowexactlywhenthatmighthappen,andIcanseethatwithtight
loopsprocessinglotsofentitiesyoumightrunintotrouble.
Itis,indeed,betterpracticetoexplicitlydisposeoftheResultBuffers,soI'vemodifiedmycodetodoso.
Thanksforthecomment!

Reply Share

RolandFeletic 9yearsago

Thankyouforyourgreatexamples,Kean.
ItwouldbereallygreatifyoucouldshowusanexampleinC#ofaddinganewannotationscaletoanentitylikeNikolaysaid.

Reply Share

SenthilPrabu 9yearsago

HiKeanWalmsley,
WhatarealltheReferencesweneedtoaddforthecoding
"AddingXDatatoAutoCADentitiesusing.NET",
PleasesendmeASAP.
Regards,
SenthilPrabu,
Banglore,
INDIA.

Reply Share

KeanWalmsley

Mod 9yearsago

HiSenthil,
Youneedreferencestoacmgd.dllandacdbmdg.dll.Seethispreviouspostitshouldhelpyougetstarted:
http://throughtheinterface.t...
Regards,
Kean

Reply Share

SenthilPrabuBR 9yearsago

iamworkingasaCADprogrammer,usally,iamcreatingtheprogramsusingLISP&VBA,NowiamtryingtocreatetheProgramthroughVB.Net
Hereitriedasamplecode,Whilecompilingthefollowingerrorsisshowing.
"Namespaceortype'EditorInput'fortheImports'Autodesk.AutoCAD.EditorInput'cannotbefound."
Pleasegivemeanidea,Whattodo?

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

4/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

Pleasegivemeanidea,Whattodo?
Thanks&Regards,
SenthilPrabuBR
Banglore,
INDIA.

Reply Share

KeanWalmsley

Mod 9yearsago

acmgd.dllshouldincludewhatyouneed...whatversionofAutoCADareyouusing?

Reply Share

SenthilPrabuBR 9yearsago

HiKean,
Iamusing
AutoCADADT2005
MicrosoftVisualStudio2003
forthissampleprogramswhichversionweneedtouse?
Regards,
SenthilPrabuBR

Reply Share

KeanWalmsley

Mod 9yearsago

HiSenthil,
YouneedtodownloadtheObjectARXSDKforAutoCAD2005fromhttp://www.autodesk.com/object....Inthesamples/dotNetfolderyouwillfind
somesamples.
The.NETAPIwasreallya"preview"inAutoCAD2005.AutoCAD2006hadthefirst"complete".NETAPIavailable.Soyoumaywellhave
difficultyrunningsomeofthesamplespostedtothisblog.
Regards,
Kean

Reply Share

KeanWalmsley

Mod 9yearsago

Roland,
OK,Ihearyou...I'mworkingonit.:)
Kean

Reply Share

Prabhu 9yearsago

Hi,
Howdoimovethelinkandlabeltemplatefromoneobjecttoanotherprogrammatically?[UsingC#orVB.NET]
Myscenariois,Ijustwanttorelocatetheemployeeintooneroomtoanother.
[I'mshowingtheinformationabouttheemployeeintheRoom.IwanttomovethosedetailintoanotherRoom]
Cananyonehelpmeonthis?
PrabhuP
Chennai.

Reply Share

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

5/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

KeanWalmsley

Mod 9yearsago

HiPrabhu,
Thispostshouldbeofsomeusetoyou.
Regards,
Kean

Reply Share

Marek 8yearsago

HiKean.
Yourbloggratjob.
So...thisismyproblem.
HowcanIchangeonevalueinxdata?
Forexample,thisismyprocedure.WhatIwritewrong?
publicstaticvoidPutAtrExdata(ObjectIdObjectId,stringDataAtr,stringDataValue)
{
Databasedb=Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database
using(Transactiontm=db.TransactionManager.StartTransaction())
{
DBObjectobj=tm.GetObject(ObjectId,OpenMode.ForWrite)
TypedValue[]exd
exd=obj.XData.AsArray()
for(inti=0i<exd.Lengthi++)
{
if(exd[i].Value.ToString()==DataAtr)
{
seemore

Reply Share

KeanWalmsley

Mod 8yearsago

YouneedtochangeyourSetValuecall:
exd.SetValue(newTypedValue(exd[i].TypeCode,DataValue),i)
Regards,
Kean

Reply Share

GaganGajabaharia 8yearsago

HiKean,
Canyoushowhowtoclear/deleteorjustsimplydoawaywiththeXDatathatisassociatedwithaDBObject?Itriedtodothisbysimplysettingit
tonullptrasindbObj>XData=nullptrbutitjustdoesn'tworkbecausenexttimewhenIcheckfortheXDataonthesameobject,itisstillthere,
andvalid.Anythoughtsmuchappreciated.Ihavealsopostedthisqinthea.a.c.dotnetforum,Ihopeyoudon'tmindmultipost.Thanks!

Reply Share

GaganGajabaharia 8yearsago

Nevermind,Kean,Igotit.IneedtosetanewresbuftoDBObjectsettingtonullptrwon't(andshouldn't)work,obviously.

Reply Share

Amy 8yearsago

Hi,
Iamworkingonawindowsapplicationbyusingc#.net.Ihaveadrawingonwhichtherearetworectangles.Oneisarackobjectandanotherisa
windowobject.IwanttoaddthesetwoobjectstoAutoCADasawindowobjectandarackobject.Howcanweaccomplishthisasrectangleis

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

6/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

sameobjectforAutoCAD.CanwedefineourownobjectsinAutoCADbyusingtheexistingones.

Reply Share

KeanWalmsley

Mod 8yearsago

YoucancreateDynamicBlocks(recommended)oruseC++todefinecustomobjects(lotsofwork).
Kean

Reply Share

Amy 8yearsago

HiKean,
Thanksforyourreply.IwanttocreateadrawinginAutoCADbyusingmyowncustomobjectsandthenimportittomywindowsapplication.(I
havetouseAPIsuchasObjectARXoratoolsuchasDOTNETARX)CaniuseDynamicblocksinthiscase?Pleasesuggest.
Regards
Amy

Reply Share

KeanWalmsley

Mod 8yearsago

"Import"couldmeanalotofthings.IftheexternalapplicationneedtoreadDWGdata,thenyouwoulduseRealDWGandgetaccesstoyour
customobjects(ortotheDynamicBlockdata).
I'drecommendinvestingafewdaysintryingoutasimplecasewithDynamicBlocksbeforestartingdownthelongroadtocustomobjects.
Kean

Reply Share

Amy 8yearsago

ThanksKean
Thiswasreallyveryhelpful.
Amy

Reply Share

CADbloke 8yearsago

JustawarningaboutXDataATTSYNCerasesit.
FromAutoCADHelp...
WarningATTSYNCremovesanyformatorpropertychangesmadewiththeATTEDITorEATTEDITcommands.Italsodeletesanyextended
dataassociatedwiththeblock,andmightaffectdynamicblocksandblockscreatedbythirdpartyapplications
Thanksfortheblog.
cheers
Ewen

Reply Share

giuliano 7yearsago

IHavethesameGaganGajabahariaproblem..
CannotclearmyxdataifisettoNullmyXdatafield.anyidea?Thanks

Reply Share

KeanWalmsley

Mod 7yearsago

Gagansolvedtheproblemhimself,ifyoulookathisnextcomment...hopefullythatalsoworksforyou,Giuliano.
Kean

Reply Share

ttnna 7yearsago

HiKean,

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

7/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

HiKean,
isitpossibletoreadobjectdatafromadwgfile?
regards,

Reply Share

KeanWalmsley 7yearsago

IassumeyoumeanMap3D'sobjectdataandunfortunatelyIdon'tknowtheanswer:pleaseaskyourquestionontheAutoCADMap3D
DeveloperDiscussionGroup.
Kean

Reply Share

izz 6yearsago

Isettheresultbuffertonull
butitdidn'twork

Reply Share

izz 6yearsago

AlsoSettingDbobjecttoanewemptyresultbufferdoesn'twork

Reply Share

KeanWalmsley 6yearsago

TrycreatinganemptyResultBufferandassigningthattotheXDataproperty.
Kean

Reply Share

yaqi 6yearsago

ThisexampleshowsaddxdatatoAutoCAD.
HowtoeditXDataandsetitbacktoobject?
mycodeislikethis
objFixture=trans.GetObject(objID,OpenMode.ForWrite)
xdataFixture=objFixture.GetXDataForApplication(STR_XDATA_FIXTURE)
DimvarFixXData()AsTypedValue=xdataFixture.AsArray
IfUBound(varFixXData)<>MAX_INDEX_XDATA_FIXTUREThen
ReDimPreservevarFixXData(MAX_INDEX_XDATA_FIXTURE)
EndIf
varFixXData(INDEX_XDATA_FIXTURE_ZONE_HANDLE)=NewTypedValue(1000,strZoneHandle)
AddRegAppTableRecord(STR_XDATA_FIXTURE)
DimrbNewFixXDataAsResultBuffer=NewResultBuffer(varFixXData)
objFixture.XData=rbNewFixXData
rbNewFixXData.Dispose()
xdataFixture.Dispose()
trans.Commit()
butitdoesn'twork,anyhelp
Thanks

Reply Share

KeanWalmsley 6yearsago

Idon'thavetimetotroubleshootyourcode:theSXDcommandshouldbeclearenoughandfunctional.
IfyouneedmorehelpIsuggestcontactingtheADNteam,ifyou'reamember,orotherwisepostingtotheAutoCAD.NETDiscussionGroup.

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

8/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

Kean

Reply Share

MatusBrlit 5yearsago

Ihadthesameproblemasizz,butmanagedtosolveitaftersomeinvestigation.
TheResultBuferactuallycan'tbeempty,ithastocontainoneTypedValuewiththeDxfCode.ExtendedDataRegAppNamefortheapplication,thatit
belongedto.
Itisalsosafeforotherapplications,thatmighthavesomeXDatastoredintheentity,becauseitonlyremovestheXDatarelatedtothespecified
application.
Ihopethishelpedsomeone.

Reply Share

Vladimir 5yearsago

Hello.IamwriteonVB.net,andIamusingXdata
PleasegivemethiscodeonVB.net

Reply Share

KeanWalmsley 5yearsago

Idon'tprovidethisservice,butthispostshouldhelp.
Kean

Reply Share

Vladimir 5yearsago

ThankyouverymutchKean.YouhelpmetotranslateC#codeintoVB.netcode.

Reply Share

qu 5yearsago

howtochangecustomDPpropertiesinAutoCAD?

Reply Share

KeanWalmsley 5yearsago

SorryIdon'tunderstandthequestion.Andasitdoesn'tseemrelatedtothispost,pleasepostittotheADNteam,ifyou'reamember,or
otherwisetheAutoCAD.NETDiscussionGroup.
Kean

Reply Share

qu 5yearsago

DearMr.Walmsley,
isthereawaytohookupbtweenalineanddatafromtableinAutoCAD?whenthedataintablechanged,thelinealsochangedwhichjustworks
likeinEXCEL.

Reply Share

KeanWalmsley 5yearsago

Certainly,butitwilltakesomework.
Andasthisisofftopic,I'mgoingtosuggestyoupostyourquestionononeofourdiscussionforums(http://discussion.autodesk.com).
Regards,
Kean

Reply Share

Qiao 4yearsago

Hi,Kean.
Iwanttodrawapolyline,addanXDatatoit,thenreturntheObjectId.ThenIaddtheObjectIdtoaobjectIdCollection.Sometimelater,Iwilliterate
theObjectIdCollection,IwantgettheXDataback.Canthisbedone?

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

9/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

theObjectIdCollection,IwantgettheXDataback.Canthisbedone?

Reply Share

KeanWalmsley 4yearsago

HiQiao,
CertainlyXDatapersistsalongwiththeentityit'sattachedto.
Regards,
Kean

Reply Share

Steve 4yearsago

Kean,
Thanksforthepost,veryhelpful.OnequestionIhavethoughiswithACADDimensions.Ihavewrittencodethatprogrammaticallycreatesa
dimensionstyleandsetsthedimensionproperties.Whencreatingdimensionsthisway,theyresultinhavestyleoverrides,whichIknowisstored
inXData.IsthereawaytoremovetheXDatasothestyleoverrideswon'tshow?I'vetriedtosettheDimStyleTableRecord.XDatatonothingas
wellastheDimStyleTableRecord.HasSaveVersionOverridetofalse.
Sorryifthisisonthewrongpost,butIthoughttheXDatawouldfixitandit'snotworking.
Thanks!!

Reply Share

KeanWalmsley 4yearsago

Steve,
TrysettingtheXDatatonothingbypassingthroughaResultBuffercontainingjusttheRegisteredApplicationName.Here'sananalogous
commandtotheoneinthispost,althoughIhaven'tseenwhattheeffectisondimensionoverrides,specifically:
[CommandMethod("KXD")]
staticpublicvoidKillXData()
{
Documentdoc=
Application.DocumentManager.MdiActiveDocument
Editored=doc.Editor
//Asktheusertoselectanentity
//forwhichtosetXData
PromptEntityOptionsopt=
newPromptEntityOptions(
"\nSelectentity:"
)
PromptEntityResultres=
seemore

Reply Share

Mark 3yearsago

Kean,
HowwouldImodifythistoattachxdatatolayer0.InsteadofhavingtheuserselectanobjectIjustpassedtheobjectidoflayer0andeverything
seemedtoworkperfectlyperaddingawatchinvisualstudio.However,whenItrytorecallthexdataitseemstohavevanished!
Thanks,
Mark

Reply Share

KeanWalmsley 3yearsago

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

10/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

KeanWalmsley 3yearsago

Mark,
Interesting.I'dpersonallyavoidplacingXDataoncore,nongraphicalobjectssuchaslayers,butIsupposeit'stheoreticallypossible.
Idon'tknowwhyit'snotworkingforyou,though:pleasecontactADNorpostyourquestiontotheAutoCAD.NETDiscussionGroup.
Regards,
Kean

Reply Share

ChristopherClaytonBertsch 2yearsago

I'mtryingtomakeasmallplumbingappandI'mwonderinghowonegoesaboutloopingthroughxdataonanentity,orentities?
Forexample,letssayI'mtryingtoattachxdatatoalineandstorethingsPIPE(string)andthenotherinfosuchasDistrobution(string),
GPM(decimal),velocity(decimal),etc.ThenonacircleIwanttoattachFIXTURE(string)andotherdatathatcouldbedifferentfromthe"pipe"
xdata.
NowIwanttoloopthroughasingleentity,orgroupofentities...HowdoIknowwhichxdataiswhat?HowdoIknowwhenIgettotheGPMvalue
onanentitythatisalineandcontainsthexdataPIPE?MyonlythoughtwastousestringsforallthexdatasoIcouldprefixeverythingwithwhat
thethe'tag'or'property'is(PIPE,GPM:10,Distribution:HOT,Velocity:8,etc)....Iknowthatwouldbeaterriblewaytodoit.DoIjustlookforPIPE
orFIXTUREandthenkeeptrackofthexdatabyindex,whatisrecommended?

Reply Share

Loadmorecomments

ALSOONTHROUGHTHEINTERFACE

LockingandunlockingAutoCADlayersvisiblyusing.NET

TherelationshipbetweenAutodeskResearchandLabs

4comments3monthsago

2comments5daysago

AvatarKeanWalmsleyHiPaul,Idon'tknow,offthetopofmyhead.Atthe

AvatarKeanWalmsleyHiJames,That'sagreatpoint.Theengineering
researchteamsdoengagewithsmallgroupsofcustomersinthisway
itmay

veryleastthisapproachshouldwork,ifyoucan'tfindabetterway.
Regards,Kean

AutoCAD2017fordevelopers

CapturinganimageofthecurrentAutoCADdocumentusing
.NET

2commentsamonthago

2comments3monthsago

AvatarFrablatorhttp://www.graytechnical.com/s...

AvatarKeanWalmsleyHiJason,Ijustgaveitatry:ifyouchangethe
drawingbackgroundtowhite,thesavedbitmapwillalsohaveawhite
background.To

Subscribe

AddDisqustoyoursiteAddDisqusAdd

Privacy

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

11/12

4/20/2016

AddingXDatatoAutoCADentitiesusing.NETThroughtheInterface

Autodesk(http://autodesk.com/)

http://throughtheinterface.typepad.com/through_the_interface/2007/04/adding_xdata_to.html

12/12

Вам также может понравиться