autocad map 3d 2009 autolisp reference - … map 3d 2009 autolisp reference ... , map plotting, and...

527
AutoCAD Map 3D 2009 AutoLISP Reference 071020 AutoCAD Map 3D AutoLISP functions cover data extension (drawing sets, queries, object data... the "ADE" functionality), map plotting, and topology. For broader coverage of AutoCAD Map 3D functionality, use the .NET API, which is included in the AutoCAD Map 3D SDK. The SDK is a separate installation from AutoCAD Map 3D itself. You can download it from the Autodesk web site. Note The AutoLISP API remains available to support legacy applications that use it. For all new development, the .NET API is the best choice. To download the AutoCAD Map 3D SDK 1. Open the Autodesk Home Page (it opens in a new window) and click Search. 2. Search for "ObjectARX for Autodesk Map 3D". 3. Click "Developer Center - ObjectARX for Autodesk Map 3D". 4. Click "License And Download". Three Functional Groups AutoCAD Map AutoLISP comprises three functional groups: Data Extension Functions Plotting Functions Topology Functions

Upload: hoangtruc

Post on 19-May-2018

348 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AutoCADMap3D2009AutoLISPReference071020

AutoCADMap3DAutoLISPfunctionscoverdataextension(drawingsets,queries,objectdata...the"ADE"functionality),mapplotting,andtopology.

ForbroadercoverageofAutoCADMap3Dfunctionality,usethe.NETAPI,whichisincludedintheAutoCADMap3DSDK.TheSDKisaseparateinstallationfromAutoCADMap3Ditself.YoucandownloaditfromtheAutodeskwebsite.

NoteTheAutoLISPAPIremainsavailabletosupportlegacyapplicationsthatuseit.Forallnewdevelopment,the.NETAPIisthebestchoice.

TodownloadtheAutoCADMap3DSDK

1. OpentheAutodeskHomePage(itopensinanewwindow)andclickSearch.

2. Searchfor"ObjectARXforAutodeskMap3D".3. Click"DeveloperCenter-ObjectARXforAutodeskMap3D".4. Click"LicenseAndDownload".

ThreeFunctionalGroups

AutoCADMapAutoLISPcomprisesthreefunctionalgroups:

DataExtensionFunctionsPlottingFunctionsTopologyFunctions

Page 2: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

BeforeYouBegin

TodevelopAutoLISPapplicationsforAutoCADMap,youshouldbefamiliarwithAutoCAD,theAutoCADMapuserinterface,andtheAutoLISPAPIforAutoCAD.

RelatedTopics

UsingAutoLISPFunctionsNumericIdentifiersTypographicConventions

Page 3: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

What'sNew

NonewfeaturesorenhancementshavebeenaddedtoAutoLISPforAutoCADMap3D2008.

Page 4: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DataExtensionFunctionCatalogFunctionSynopsis

DataExtensionfunctionslistedalphabetically.

alias|altp|ds|dwg|edit|ent|err|expr|key|od

os|pref|proj|ql|qry|rt|save|sql|ss|user|ver

ade_aliasaddade_aliasdeleteade_aliasgetlistade_aliasupdate

ade_altpclearade_altpdefineade_altpdelpropade_altpgetpropade_altplistade_altpsetprop

ade_dsattachade_dsdetachade_dsisnestedade_dslistade_dsproplist

ade_dwgactivateade_dwgactualpathade_dwgaliaspathade_dwgattriblistade_dwgdeactivateade_dwggetidade_dwggetsetting

Page 5: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwghaslocksade_dwgindexade_dwgindexdefade_dwgisactiveade_dwgistoplevelade_dwgproplistade_dwgquickviewade_dwgselectdlgade_dwgsetofade_dwgsetsettingade_dwgunlockade_dwgzoomextents

ade_editdefcenade_editlockederasedade_editislockedade_editlockedade_editlockobjsade_editnewade_editunlockobjs

ade_entsetlocation

ade_errclearade_errcodeade_errgetlevelade_errmsgade_errpushade_errpushstatementade_errqtyade_errsetlevelade_errshowdlgade_errstatementade_errtype

ade_expreval

ade_keycolumnlist

ade_odaddfield

Page 6: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odaddrecordade_odattachrecordade_oddefinetabade_oddeletefieldade_oddeletetabade_oddelrecordade_odfreerecade_odgetfieldade_odgetrecfieldade_odgetrecordade_odgettablesade_odmodifyfieldade_odmodifytabade_odnewrecordade_odpresetfieldade_odrecordqtyade_odsetfieldade_odtabledefnade_odtablelist

ade_osfexpand

ade_prefgetvalade_prefsetval

ade_projgetctgynameade_projgetinfoade_projgetwscodeade_projlistcrdsystsade_projlistctgyade_projptbackwardade_projptforwardade_projsetdestade_projsetsrcade_projsetwscode

ade_qldelctgyade_qldelqueryade_qlgetctgyinfo

Page 7: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlgetqryinfoade_qllistctgyade_qlloadqryade_qlqrygetidade_qlsetctgynameade_qlsetquery

ade_qryclearade_qrydefineade_qryexecuteade_qrygetcondade_qrygetdwgandhandleade_qrygetentlistade_qrygetreptransformade_qrygroupade_qryhandentade_qrylistade_qrysaveade_qrysetaltpropade_qrysetcondade_qrysetreptransformade_qrysettypeade_qryungroup

ade_rtdefrangeade_rtdeltableade_rtgetidade_rtgetpropade_rtlist

ade_saveobjsade_savetodwg

ade_sqlgetenvstring

ade_ssfree

ade_usergetade_usergetrightsade_userlist

Page 8: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_usersetade_usersetrights

ade_version

Page 9: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DataExtensionFunctionSynopsisFunctionCatalog

DataExtensionfunctionslistedbyfunctionalgroup.

CoordinateTransformationFunctions

DrawingFunctions

DrawingSetFunctions

DriveAliasFunctions

ErrorMessageFunctions

ExpressionEvaluationFunction

ObjectDataFunctions

ObjectEditingFunctions

ObjectSavingFunctions

OptionFunctions

PropertyAlterationFunctions

QueryFunctions

QueryLibraryFunctions

RangeTableFunctions

SQLEnvironmentFunctions

TextLabelFunction

UserSecurityFunctions

Page 10: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

OtherFunctions

Page 11: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PlottingFunctionCatalogFunctionSynopsis

Plottingfunctionslistedalphabetically.

dwg|plt|topo

map_dwgbreakobjmap_dwgtrimobj

map_pltblkattsmap_pltblklistmap_pltblkvpsmap_pltcleanupmap_pltcurrdefmap_pltcurrdelmap_pltcurrgetmap_pltcurrsavemap_pltcurrsetmap_pltdefdeletemap_pltdefgetmap_pltdeflistmap_pltdefreadmap_pltdefsavemap_pltdefvalidmap_pltdefverifymap_pltdisplaymap_pltexecutemap_pltinitmap_pltplotmap_pltrestore

Page 12: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_topoauditmap_topoclosemap_topocompletemap_topostat

Page 13: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PlottingFunctionSynopsisFunctionCatalog

Plottingfunctionslistedbyfunctionalgroup.

BoundaryFunctions

PlottingFunctions

TopologyFunctions

Page 14: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyFunctionCatalogFunctionSynopsis

Topologyfunctionslistedalphabetically.

ac|ana|clean|edit|elem|info|iter|mnt|qry|trace|var

tpm_acclosetpm_acexisttpm_acloadtpm_acopentpm_acqtytpm_acunloadtpm_acupgradeopen

tpm_anabuffertpm_anadissolvetpm_anaoverlay

tpm_cleanactionlistdeltpm_cleanactionlistgetattpm_cleanactionlistinstpm_cleanactionlistqtytpm_cleanalloctpm_cleananchorsstpm_cleancanceltpm_cleancompletetpm_cleancreatedsstpm_cleanendtpm_cleanerrorcurtpm_cleanerrordrawtpm_cleanerrorfix

Page 15: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrorgettpm_cleanerrormarktpm_cleanerrorsettpm_cleanfreetpm_cleangroupdrawtpm_cleangroupfixtpm_cleangroupmarktpm_cleangroupnexttpm_cleangroupqtytpm_cleangroupsubtypetpm_cleangrouptypetpm_cleanincludesstpm_cleaninittpm_cleaninitanchorsettpm_cleanmodifiedsstpm_cleanprofileloadtpm_cleanprofilesavetpm_cleanstarttpm_cleanunchangedss

tpm_editaddelemtpm_editdelelemtpm_editmodelemtpm_editupdelem

tpm_elemadjtpm_elemfindtpm_elemgettpm_elemidtpm_elemqtytpm_elemss

tpm_infobuildvartpm_infocompletetpm_infocorrecttpm_infocurrenttpm_infodesctpm_infomodifiedtpm_infoname

Page 16: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infostatustpm_infotypetpm_infoversion

tpm_iterdesctpm_iternametpm_iternexttpm_iterstarttpm_iterstoptpm_itertypetpm_iterversion

tpm_mntbuildtpm_mnterasetpm_mntrebuildtpm_mntrename

tpm_qrygetresdesctpm_qrygetrestopotpm_qrygettoponametpm_qrysetrestopotpm_qrysettoponame

tpm_tracealloctpm_tracebestroutetpm_tracebestroutescantpm_tracebestroutevaltpm_traceelemedittpm_traceelemgettpm_traceelemidtpm_tracefloodtpm_tracefreetpm_traceqtytpm_tracesetmaxrestpm_tracesetminrestpm_traceshorttpm_traceshortscantpm_traceshortval

tpm_varalloc

Page 17: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_varfreetpm_vargettpm_varlisttpm_varset

Page 18: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyFunctionSynopsisFunctionCatalog

Topologyfunctionslistedbyfunctionalgroup.

AccessFunctions

AnalyzingFunctions

BuildingandErasingFunctions

CleanupFunctions

EditingFunctions

ElementInformationFunctions

IteratingFunctions

NetworkTracingFunctions

TopologyInformationFunctions

TopologyQueryFunctions

TopologyVariablesFunctions

Page 19: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ConfigurationVariables

Configurationvariablesincludethreesubsets:

Cleanupvariables,propertiesforcleanupmodels.

Cleanupactionvariables,propertiesforcleanupactions.

Topologyvariables,propertiesfortopologies.

Toallocateasetofconfigurationvariables,regardlessofwhichsubsetyouwillbeusing,usetpm_varalloc,whichreturnsanade_idforthesetthatitcreates.

Tofreeasetofconfigurationvariables,usetpm_varfree.

Togetthevalueofaconfigurationvariable,usetpm_varget.

Tosetthevalueofaconfigurationvariable,usetpm_varset.

Togetthepropertiesofagivencleanupaction,firstallocateanewsetofvariables,andthenusetpm_cleanactionlistgetat.

Togetthepropertiesofagiventopology,firstallocateanewsetofvariables,andthenusetpm_infobuildvar.

Tolistallthevaluesofagivensetofvariables,usetpm_varlist.

Page 20: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyVariables

Topologyvariablesstorepropertiesfortopologies,whicharecreatedbytpm_mntbuildandthetopologyanalysysfunctions,tpm_ana[xx].

Topologyvariablesareasubsetoftheconfigurationvariablesdatastructure.

BUILD_TOL Tolerancefortopologybuilding,buffering,andotherprocesses(positivereal).Default=0.01

CNTR_COLOR Colorfornewcentroids,anAutoCADcolorindex(integer).Negativeinteger=CurrentcolorDefault=-1SeeColorIndexColors.

CNTR_LAYER Layernamefornewcentroids(string).nil=CurrentlayerDefault=""

CNTR_TYPE Entitytypeofnewcentroids(integer).1=Point(default)

Page 21: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2=Block

CNTR_BLOCK Blocknamefornewcentroids(string).Default=""

CREATE_CNTR Flagforcentroidsgeneration(integer).1=Generate(default)0=Donotgenerate

CREATE_MARKERS Whethererrorsshouldbemarkedwithpersistentmarkersasdrawnbytpm_cleanerrormark(integer).0=Donotmark(default)1=MarkMarkershapesaresetbyMARKER_HEIGHTandthe[XX]_MARKERcleanupvariables.

CREATE_NODE Flagfornodesgeneration(integer).1=Generate(default)0=Donotgenerate

CREATE_VIEW Whethererrorsshouldbemarkedwithtemporarymarkersasdrawnbytpm_cleanerrordraw0=Donotmark1=Mark(default)

DEF_OFFSET Defaultoffset(real).

Page 22: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Usewhenoffsetvaluecannotbecalculatedforanobject,forexample,iftheobjectlacksnecessaryobjectdata.Default=1.0

DUPLICATE_CENTROID_COLOR Markercolorforduplicatecentroiderrors,anAutoCADcolorindex(integer).Default=1(red)SeeColorIndexColors.

DUPLICATE_CENTROID_MARKER Markershapeforduplicatecentroiderrors(integer).SeeMarkerShapes.Default=4(square)

IGNORE_INCOMPLETE_AREA Whattodoiflinksareencounteredthatdonotbelongtoanypolygon(integer).1=Ignorethem0=Canceltopologycreationprocess(default)

INCOMPLETE_AREA_COLOR Markercolorforincompleteareaerrors,anAutoCADcolorindex(integer).Default=2(yellow)SeeColorIndexColors.

INCOMPLETE_AREA_MARKER Markershapeforincompleteareaerrors(integer).SeeMarkerShapes.Default=2(triangle)

INTERSECTION_COLOR Markercolorforintersection

Page 23: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

errors,anAutoCADcolorindex(integer).Default=3(green)SeeColorIndexColors.

INTERSECTION_MARKER Markershapeforintersectionerrors(integer).SeeMarkerShapes.Default=1(octagon)

MISSING_CENTROID_COLOR Markercolorformissingcentroiderrors,anAutoCADcolorindex(integer).Default=4(cyan)SeeColorIndexColors.

MISSING_CENTROID_MARKER Markershapeformissingcentroiderrors(integer).SeeMarkerShapes.Default=3(rhombus)

NODE_BLOCK Blocknamefornewnodes(string).Default=""

NODE_COLOR Colorfornewnodes,anAutoCADcolorindex(integer):Negativeinteger=ThecurrentcolorDefault=-1SeeColorIndexColors.

NODE_LAYER Layernamefornewnodes(string):nilThecurrentlayerDefault=""

Page 24: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

NODE_TYPE Entitytypeofnewnodes(integer):1Point(default)2Block

STOP_AT_MISSING_CNTR Whattodoifapolygonhasnocentroid(integer):0Createacentroid(default)1Canceltopologycreationprocess

STOP_AT_MULTIPLE_CNTR Whattodoifapolygonhasmorethanonecentroid(integer):0Designateonecentroid1Canceltopologycreationprocess(default)

Page 25: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CleanupVariables

Cleanupvariablesstorepropertiesforcleanupmodels.

Cleanupvariablesareasubsetoftheconfigurationvariablesdatastructure.

NoteDatatypescitedbelowareAutoLISPtypes.TheAutoLISPrealcorrespondstotheC++double.Similarly,integercorrespondstolong.

ANCHOROBJS_FEATURES !!New!!Classifiedobjectstoinclude,acomma-separatedlistoffeaturenames(string),suchas"Roads,Rivers,Streets".Default="*"(allfeatures).

ANCHOROBJS_LAYERS Anchoredentitiesspecifiedbytpm_cleaninitanchorsetwillbeanchoredonlyiftheyresideonlayersspecifiedhere,withmultiplelayernamesseparatedbycommas.Forexample,"0,Layer1,Layer2".Default="*"(anylayer)

Page 26: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

APPARENT_INTERSECTION_COLOR !!New!!Colorforapparent-intersectionmarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=7(white)

APPARENT_INTERSECTION_MARKER !!New!!Markershapeforapparent-intersectionerrors(integer).SeeMarkerShapes.Default=2(triangle)

ARC_TYPE Convertarcsto(integer):0=Arc(default)1=2Dpolyline

CIRCLE_TYPE Convertcirclesto(integer):0=Circle(default)1=2Dpolyline2=Arc

CLEAN_TOL Cleanuptolerance(positivereal).Default=0.01

CLUSTER_COLOR Colorforclustermarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=5(blue)

CLUSTER_MARKER Markershapeforclustererrors(integer).SeeMarkerShapes.Default=4(square)

Page 27: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CONVERT Flagfortheoriginalentitiesconversion(integer).0=Donotconvert(default)1=Convert

CORRIDOR Corridorwidth(positivereal).Default=0.01NoteIfyouareusinganexplicitcleanupactionlist(specifyingcleanupactionsusingtpm_cleanactionlistins),thissettingisignored.

CROSS_COLOR Colorforcrossmarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=2(yellow)

CROSS_MARKER Markershapeforcrosserrors(integer).SeeMarkerShapes.Default=1(octagon)

DANGL_COLOR Colorfordanglingnodemarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=1(red)

DANGL_MARKER Markershapefordanglingnodeerrors(integer).SeeMarkerShapes.

Page 28: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Default=1(octagon)

DEL_MARKER Whethertodeletepreviouserrormarkers(integer).0=Donotdelete1=Delete(default)

DUPL_COLOR Colorforduplicatesmarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=6(magenta)

DUPL_MARKER Markershapeforduplicateerrors(integer).SeeMarkerShapes.Default=1(octagon)

ENT_PROCESS Flagfororiginalentitiesprocessing(integer).1=Convertoriginal2=Createnewandkeeporiginal3=CreatenewanddeleteoriginalDefault=0

GENERALIZE Flagforgeneralization(linksimplication)(integer).0=Donotgeneralize(default)1=GeneralizeNoteIfyouareusinganexplicitcleanupactionlist(specifyingcleanupactions

Page 29: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

usingtpm_cleanactionlistins),thissettingisignored.

INCLUDE_LINEAROBJS !!New!!Whethertoincludelinearobjectswhiledeletingduplicates(integer).0=Donotinclude.1=Include.Default=1.

INCLUDE_POINTS !!New!!Whethertoincludepointswhiledeletingduplicatesorsnappingclusterednodes(integer).0=Donotinclude.1=Include.Default=1.

INCLUDE_BLOCKS !!New!!Whethertoincludeblockswhiledeletingduplicatesorsnappingclusterednodes(integer).0=Donotinclude.1=Include.Default=0.

INCLUDE_TEXT !!New!!Whethertoincludetextwhiledeletingduplicates(integer).0=Donotinclude.1=Include.Default=0.

Page 30: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

INCLUDE_MTEXT !!New!!Whethertoincludemtextwhiledeletingduplicates(integer).0=Donotinclude.1=Include.Default=1.

INCLUDE_ROTATION !!New!!Whethertoincluderotationwhiledeletingduplicates(integer).0=Donotinclude.1=Include.Default=0.

INCLUDE_ZVALUES !!New!!Whethertoincludez-valueswhiledeletingduplicates(integer).0=Donotinclude.1=Include.Default=0.

SNAP_TO_NODE !!New!!Whethertosnaptonodesorlinks(integer).0=Snaptonodes.1=Snaptolinks.Default=0.

INCLUDEOBJS_AUTOSELECT Howentitiesarespecifiedforcleanup0=Selectentitiesmanually(thatis,bypassinga

Page 31: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

selectionsettotpm_cleaninit)1=Selectallentitiesinthedrawing(inwhichcasetheselectionsetpassedtotpm_cleaninit,ifany,isignored)

INCLUDEOBJS_FEATURES !!New!!Classifiedobjectstoinclude,acomma-separatedlistoffeatures(string),suchas"Roads,Rivers,Streets".Default="*"(allfeatures).

INCLUDEOBJS_LAYERS Entitiesspecifiedbytpm_cleaninitwillbecleanedonlyiftheyresideonlayersspecifiedhere,withmultiplelayernamesseparatedbycommas.Forexample,"0,Layer1,Layer2".Default="*"(anylayer)

LINE_TYPE Convertlinesto(integer)0=Line(default)1=2Dpolyline

LINK_COLOR Colorfornewlinks,anAutoCADcolorindex(integer).SeeColorIndexColors.Negativeinteger=Currentcolor

Page 32: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Default=-1

LINK_CORRECT Flagforlinkerrorcorrection(integer).0=Donotcorrect1=Correct(default)NoteIfyouareusinganexplicitcleanupactionlist(specifyingcleanupactionsusingtpm_cleanactionlistins),thissettingisignored.

LINK_ERROR Linkerrortypes(integer),sumofthedesiredoptions.0=None1=Short2=Cross4=Undershoot8=DuplicateDefault=15

LINK_LAYER Layernamefornewlinks(string).nil=CurrentlayerDefault=""

MAINTAIN_MARKERS Flagtomaintainmarkerswhencleanupends0=Donotmaintain1=MaintainmarkersThisvariableaffectsonlyerrorsthathavenotbeenfixed.Ifanerrorhasbeenfixed,itsmarkerisdeletedattheendofthecleanup

Page 33: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

processnomatterwhat(bytpm_cleanend).

MARKER_HEIGHT Theheightoferrormarkers,apercentofscreenheight(positivereal).Default=5.0

NODE_CORRECT Flagfornodeerrorcorrection(integer).0=Donotcorrect1=Correct(default)NoteIfyouareusinganexplicitcleanupactionlist(specifyingcleanupactionsusingtpm_cleanactionlistins),thissettingisignored.

NODE_ERROR Nodeerrortypes(integer),sumofthedesiredoptions. 0=None16=Cluster32=Pseudo64=DanglingDefault=48

POLY3D_TYPE Convert3Dpolylinesto(integer).0=3Dpolyline(default)1=2Dpolyline

PSEUDO_COLOR Colorforpseudonodemarkers,anAutoCAD

Page 34: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

colorindex(integer).SeeColorIndexColors.Default=6(magenta)

PSEUDO_MARKER Markershapeforpseudonodeerrors(integer).SeeMarkerShapes.Default=2(triangle)

SHORT_COLOR Colorforshortmarkers,anAutoCADcolorindex(positiveinteger).SeeColorIndexColors.Default=1(red)

SHORT_MARKER Markershapeforshorterrors(integer).SeeMarkerShapes.Default=1(octagon)

UNDER_COLOR Colorforundershootmarkers,anAutoCADcolorindex(integer).SeeColorIndexColors.Default=3(green)

UNDER_MARKER Markershapeforundershooterrors(integer).SeeMarkerShapes.Default=1(octagon)

WEED_DISTANCE !!New!!Weedingdistance(real).Default=15.0

WEED_ANGLE !!New!!Weeddistance

Page 35: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(real).Default=4.0

WEED_SUPPLEMENT_DISTANCE !!New!!Weedsupplementdistance(real).Default=100.0

WEED_SUPPLEMENT_BULGE !!New!!Weedsupplementbulge(real).Default=1.0

Page 36: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CleanupActionVariables

Cleanupactionvariablesstorepropertiesforcleanupactions,whichareassignedtoactionlistsbytpm_cleanactionlistins.

Actionlistsareafeatureofcleanupmodels.Cleanupactionvariablesareasubsetoftheconfigurationvariablesdatastructure.

ARC_TYPE WiththeSimplifyObjectscleanupaction(cleangrouptype128)only,whethertocreatearcs(integer).1=Createarcs(default)0=DonotcreatearcsForanyactionotherthan128,SimplifyObjects,ARC_TYPEdoesnotmatter.

CLEAN_TOL Cleanuptolerance(positivereal).Default=0.01CLEAN_TOLaffectsthefollowingactionsonly:8=DeleteDuplicates1=EraseShortObjects4=ExtendUndershoots16=SnapClusteredNodes64=EraseDanglingObjects128=SimplifyObjectsWiththefollowingactions,theCLEAN_TOLvaluedoesnotmatter:2=BreakCrossingObjects

Page 37: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

32=DissolvePseudoNodes256=ZeroLengthObjects

CONVERT WiththeExtendUndershootscleanupaction(cleangrouptype4)only,whethertobreakthetargetobject(insertanewnode)wheretheextendedundershootintersectsit(integer).1=Breaktarget(default)0=DonotbreaktargetForanyactionotherthan4,ExtendUndershoots,CONVERTdoesnotmatter.

Page 38: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ErrorCodes

ThefollowingerrorscodesarenativetoAutoCADMap.

Customapplicationscandefinetheirownerrorcodes.Seeade_errpush.

Youcangetanerror'serrorcodebypassingitsstackindex(0=firsterror)toade_errcode.

ErrorCodeIndex

�15 1200 2000 2500 3000

0 1300 2100 2600 3100

200 1500 2200 2700 3200

1000 1800 2300 2800 4000

1100 1900 2400 2900

Expression

�15 kErrXEDValueFail Internalerror

�14 kErrRngTabEvalFail Internalerror

�13 kErrNoRngTabFound Internalerror

�12 kErrNoRngTabLibFound Internalerror

�11 kErrLispValueFail Internalerror

Page 39: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

�10 kErrGetAttrFail Internalerror

�09 kErrGetSQLFail Internalerror

�08 kErrGetEEDFail Internalerror

�07 kErrInvalidProperty Internalerror

�06 kErrExpInvalidOperand Internalerror

�05 kErrExpADS Internalerror

�04 kErrExpNoMemforOperand Internalerror

�03 kErrExpMathOverFlow Internalerror

�02 kErrExpInvalidOper Internalerror

�01 kErrExpSyntaxErr Internalerror

FormoreExpressionerrors,whichbeginat2900,click .

CommonUsage

00 kAdeOk GeneralADEreturnvalue:calltoADEobjectissuccessful

01 kAdeErr GeneralADEerror:calltoADEobjectisnotsuccessful

02 kAdeBadInput Invalidfunctionargument

03 kAdeObjectNotFound

04 kAdeOutOfMemory

05 kAdeObjNotInitialized

06 kAdeWrongType

07 kAdeWrongProject

Page 40: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

08 kAdeEOB

09 kAdeADSError Invalidfunctionargumenttype

10 kAdeAdsNameConvertionFails

11 kAdeWrongArgument

12 kAdeWriteBufFails

13 kAdeReadBufFails

14 kAdeXDataCorrupted

15 kAdeNoEnvironment

16 kAdeUsrBreak

17 kAdeUncomparable

18 kAdePermissionDenied Nopermissiontoperformsomeaction.Whenusingthefollowingcommands,themessagehasdifferentmeanings:ADESAVEOBJS=Can'tbeexecutedindemonstrationmode;ADEDRAWINGS=Userhasnorightstoupdatetheset;ADESELOBJS,ADDREMOBJS=Userhasnorightstoedit;ADEDWGMAINT=Userneedstobesuperusertoremovetheforeignlocks;MAPOPTIONS:SystemPreferences=Can'tset"ForceUserLogin"flagandchange"ObjectLocking"flagifdrawingsetcontainsactiveorlockeddrawings.Deactivateorunlockthedrawingsbeforetryingtosetthesepreferences.

19 kAdeWrongSyntax

Page 41: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

20 kAdeDuplicate

21 kAdeInvalidPathOrFileName

22 kAdeInvalidVersion

23 kAdeFileIOFatalError

ExternalSubsystems

200 kAdeAcDbError

201 kAdeIRDNotInitialized

202 kAdeIRDError

203 kAdeASENotInitialized

204 kAdeASEError

205 kAdeASIError

206 kAdeAsiNotInitialized

207 kAdeAsiConnectToEnvironmentFailed

TransactionalManager

1000 kErrClosed RepeatedattemptstoclosepreviouslyclosedADEobject.Callsupport.

1001 kErrWasErased AttempttoworkwitherasedADEobject.Callsupport.

1002 kErrOpenForRead AttempttoupdateADEobjectsopenedforread.Callsupport.

1003 kErrOpenForWrite AttemptstogetmultipleaccesstoADEobjectopenedforwrite.Callsupport.

1004 kErrWrongMode IncorrectmodeoftheADEobjectsshouldbe

Page 42: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

opened.Callsupport.

1005 kErrClone ExceptionatthetimeofcloningADEobjects.Callsupport.

1006 kErrResponse IncorrectattempttostartADEtransaction.Callsupport.

1007 kErrObjIsAbsent AttempttoworkwitherasedADEobject.Callsupport.

1008 kErrAccess TypeofworkwithADEdoesnotcorrespondtoitsstatus.Callsupport.

1009 kErrMultipleUsage AttemptstogetmultipleaccesstoADEobjectopenedforwrite.Callsupport.

1010 kErrUpgrade IncorrectattempttoupdateopeningmodeoftheADEobject.Callsupport.

1011 kErrNotClosed ObjectwasnotclosedduringcurrentADEtransaction.Callsupport.

CAdeList

1100 kAdeGetIteratorFails

1101 kAdeListIsEmpty

CAdeListIterator

1102 kErrListEnd

1103 kErrListObjectIsAbsent

Drawing

1200 kAdeQueriedEntity Ignoringqueriedentityforsavingselection.Whenusing

Page 43: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ADESAVEOBJS,themessagemeansqueriedobjectsthatareselectedforsavebackareignored.

1201 kAdeDwgNotActive Attempttoreadtheobjectlockedfromaninactivedrawing.WhenusingADEWHOHASIT,themessagemeansthedrawingfromwhichtheobjectwasqueriedisnolongeractive.ADEisunabletodetermineiftheobjectselectediscurrentlylocked.Activatethespecifieddrawingandre-enterthecommand.

1202 kAdeReadDwgFileFails ADEfailstoreadexternaldrawing.IfusingADEDRAWINGS,thismessagemeansthatADEisunabletoreadthespecifieddrawing.Perhapsthedrawingdoesn'texitorthespecifiedfileisnotavalidAutoCADDrawingFile.Checktheerrormessagestackformoreinformation.

1203 kAdeMultipleUsers ADEfailstoaccessexternaldrawing.IfusingADEDRAWINGS,thismessagemeansADEisunabletoaccessthespecifieddrawingbecauseoffilelockingproblems.Checktheerrormessagestackformoreinformation.

Page 44: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1204 kAdeEntityLockingFails ADEfailstolock.IfusingADESELOBJS,thismessagemeansADEisunabletolockanobject.Theobjectmayalreadybelocked.UsetheADEWHOHASITtodetermineiftheobjectislocked,perhapsbyanotheruser.Checktheerrormessagestackformoreinformation.

1205 kAdeUnlockedEntity Entityisunlocked.IfusingADEWHOHASIT,thismessageindicatesthattheselectedobjectisnotcurrentlylocked.

1206 kAdeLockedEntity EntityhasbeenlockedbyanotherADEuser.IfusingADESELOBJS,thismessageindicatesthattheobjectisalreadylockedbyanotheruser.UsetheADEWHOHASITcommandtoidentifytheuser.

1207 kAdeAlreadyInSaveSet

1208 kAdeAlreadyNotInSaveSet

1209 kAdeMultipleReaders

1210 kAdeOpenPrefDictionaryFails ADEfailstoopenADEpreferencesdictionary.Callsupport.

1211 kAdeSavePrefDictionaryFails ADEfailstosaveADEpreferencesdictionary.Callsupport.

Page 45: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1212 kAdeRestoreDSetFails ADEfailstorestorethedrawingset.Callsupport.

1213 kAdeOpenDSetDictionaryFails ADEfailstoopenADEdrawingsetdictionary.Callsupport.

1214 kAdeSaveDSetDictionaryFails ADEfailstosaveADEdrawingsetindictionary.Callsupport.

1215 kAdeOpenQueryDictionaryFails ADEfailstoopenADEquerylibrarydictionary.Callsupport.

1216 kAdeSaveQueryDictionaryFails ADEfailstosaveADEquerylibraryindictionary.Callsupport.

1217 kAdeOpenRTableDictionaryFails ADEfailstoopenADErangetabledictionary.Callsupport.

1218 kAdeSaveRTableDictionaryFails ADEfailstosaveADErangetableindictionary.Callsupport.

1219 kAdeRestoreRTableDictionaryFails ADEfailstorestoreADErangetableindictionary.Callsupport.

1220 kAdeOpenDocViewDictionaryFails ADEfailstoopenADEDocViewinformationdictionary.Callsupport.

1221 kAdeSaveDocViewDictionaryFails ADEfailstosaveADEDocViewinformationindictionary.Callsupport.

1222 kAdeOpenKeyViewDictionaryFails ADEfailstoopenADEKeyViewinformationdictionary

1223 kAdeSaveKeyViewDictionaryFails ADEfailstosaveADEKey

Page 46: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Viewinformationindictionary.Callsupport.

1224 kAdeSaveProjectionFails ADEfailstosaveprojectioncodeinthedrawing.Callsupport.

1225 kAdeCopyHardPointerFails ADEfailstoapplypropertyalterationforsomesymboltable.Callsupport.

1226 kAdeDwgToBeReloaded

1227 kAdeDwgHasBeenModified Therewereobjectsqueriedfromthedrawingthatwillbetreatedasnewobjects.IfusingADEDRAWINGS,thismessagemeansthatwhenadrawingfromwhichobjectshavebeenqueriedisdetached,ADEconvertstheobjectsintonewlycreatedobjects.WhenyouusetheADEWHOHASITcommandtoseetheoriginoftheseobjects,itsaysthattheyhavenotbeenqueried.

1228 kAdeOnLockedLayer Objectsfromalockedlayerhavebeenselected.IfusingADESELOBJS,ADEREMOBJS,orADESAVEOBJS,thismessagemeansyouselectedobjectsfromalockedlayerandtheycannotbeaddedto,savedto,orremovedfromthesavesetorsavedtosource.

1229 kAdeDwgSaveFales ADEfailstosavethesource

Page 47: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

drawing.IfusingADESAVEOBJS,ADESELOBJS,ADEREMOBJS,OPEN,NEW,orQUIT,orifyou'reconfiguringoptions,ormodifyingobjects,youmaygetthismessage.Callsupport.NOTE:Usethismessageexactlyasspelledhere.

1230 kAdeDwgLocksLeft ADEfailstoremoveobjectlocks(ifpresent)bytheendofADEsession.IfusingOPEN,NEW,orQUIT,orifyou'reconfiguringoptions,thismessagemeansthedrawingmightbelockedbyanotherADEuser.

1231 kAdeLinkWillBeLost ADEdoesnotsavelinksbetweenqueriedobjectsandsourcedrawingsbetweenADEsessions.Detachsourcedrawingwithqueriedobjects.UsetheSAVEcommandwithqueriedobjectsornoobjectsinthesaveset.

1232 kAdeDwgDiskFull

1233 kAdeDwgHasQueriedObject

1234 kAdeDwgUnlockedFile

CurrentSession

1300 kAdeGetCPointFails=1300 ADEfailstogetTextlocationfor

Page 48: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

theentity.Callsupport.

1301 kAdeSetCPointFails ADEfailstostoreTextlocationfortheentity.Callsupport.

1302 kAdeTextInsPointMissed MissingTextinsertpoint.Callsupport.

1303 kAdeTextAllignPointMissed MissingalignmentpointforAlignedandFitText.Callsupport.

1304 kAdeTextHeightMissed MissingTextheight.Callsupport.

1305 kAdeTextStringMissed MissingTextstring.Callsupport.

1306 kAdeIndexUpdateFails ExceptioninIndexgenerationorregeneration.IfusingADESAVEOBJS,ADESELOBJS,ADEREMOBJS,orADEDWGMAINT,thismessagemeansentitymodificationoccurred.Callsupport.

1307 kAdeIgnorePreview ADEcustomobjectisselectedtoaddtosavesetortosave.IfusingADESAVEOBJS,ADESELOBJS,orADEREMOBJSthismessagehasthefollowingmeaning:WhendoingaPreviewQuery,ADEcreatesaspecialobjectcalledaPREVIEWobject,usedtodisplaythequeriedobjects.PREVIEWcannotbesavedbacktoasourcedrawing.Whenauserselectsthisobjectforaddingtothesavesetorwhensavingback,ADEdetectsthisandpreventstheoperation.

1308 kAdeIgnorePSpace

Page 49: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1309 kAdeEraseIRDObjectFails ADEfailstoerasetheObjectDataTable.Callsupport.

1310 kAdeRenameIRDObjectFails ADEfailstorenametheObjectDataTable.Callsupport.IfusingADEDEFDATA,thismessagemeansADEcan'trenameObjectDataTable.PerhapsObjectDataofthesamenamealreadyexistsinthedrawingorObjectDataTabledefinitionsbearingtheoldnamearedifferentinthesourcedrawings.Checktheerrormessageformoreinformation.

1311 kAdeAlterIRDObjectFails ADEfailstoalterObjectDataTable.IfusingADEDEFDATA,thismessagemeansADEcan'talterObjectDataTable.PerhapsObjectDataTabledefinitionsaredifferentinthesourcedrawings.Checktheerrormessagestackformoreinformation.

1312 kAdeIrdDuplicateTableName ObjectDataTablewithspecifiednamealreadyexists.ADEDEFDATA-allObjectDatatablenamesmustbeunique.Duplicatenamesarenotallowed.

1313 kAdeIrdNotIdenticaFormat ConflictinObjectDataTabledefinition.IfusingADEDEFDATA,thismessagemeansthatperhapsObjectDataTabledefinitionsaredifferentinthesourcedrawings.NOTE:Usethismessageexactlyasspelledhere.

Page 50: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1314 kAdeBHatchUnit ADEtreatsbhatchanditsboundaryasoneunit.IfusingADESELOBJSorADEREMOBJS,thismessagehasthefollowingmeaning:Whenaddinganobjecttothesaveset,ADEchecksifthisobjectispartofahatchboundary.Ifitis,allotherobjectsthatformtheboundaryareaddedtoorremovedfromthesaveset.Whensavingbackbhatchedareas,ADEalwaystreatstheboundaryasoneobject.

1315 kAdeReQuery ADEqueriedoneormoreobjectstwice.ADEdoesnotsupportUNDOforthisoperation.IfusingADEQUERYorADERUNXQUERYthismessagehasthefollowingmeaning:IfadrawingfilehasbeenmodifiedbyanotherADEuserandifaqueriedobjectmatchesanotherquery,ADEremovestheoldcopyandqueriesanewcopy.Thisoperationcan'tbeundone.

1316 kAdeCantAccessFont

1317 kAdeCantAccessImageFile

1318 kAdeUnableRedefineXrefBlock

DrawingSet

1500 kAdeRestoreDrawingSetFails ADEfailstoreadDrawingSetfromDWGfile.YouencounterthismessageduringADE

Page 51: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

initializationorwhenusingOpendrawingfileorADEDRAWINGS.IfusingADEDRAWINGS-attachdrawing,themessagemeans"activateonattach"isONorade_dsattach(),ade_dswcattach()drawingiscorruptedoroldADEversionisinuse.

1501 kAdeDuplicatedDrawing Attempttoattachthesamedrawingtwice.IfusingADEDRAWINGS,thiserrorappearswhenadrawingwiththesamenamehasalreadybeenattachedtotheworksession.

1502 kAdeNestedDrawing Prohibitedattempttoeditpropertiesofthedrawinginthenesteddrawingset.IfusingADEDRAWINGS,thismessagemeansauserisnotallowedtomodifythetransformationandsavebackextentsofnesteddrawingsintheworksession.Thesepropertiescanonlybemodifiedfortopleveldrawings.

1503 kAdeActivateDrawingFails ADEfailstoactivatesourcedrawing.ADEwasunabletoactivateadrawingPerhapsthedrawingdoesnotexistoritislockedbyanotheruser,orthecurrentuserdoesn'thavepermissiontoreadthespecifieddrawingfile.Checktheerrormessagestackformoreinformation.

Page 52: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1504 kAdeDeactivateDrawingFails ADEfailstodeactivatesourcedrawing.ADEisunabletodeactivateadrawing.Perhapsthedrawingislockedbyanotheruser,thedrawingnolongerexists,ortherearelockedobjectsinthedrawing.Checktheerrormessagestackformoreinformation.

1505 kAdeLongDrawingDescription Specifieddrawingdescriptionexceeds133symbols.Shortendescription.

1506 kAdeEntityHasBeenLocked Drawingwithlockedentitiescan'tbedeactivated.ADEDRAWINGS-thespecifieddrawingcannotbedeactivatedbecauseitcontainslockedobjects.Removelocksanddeactivate.

1507 kAdePreviewNotSupported ADE2.0ignorestheseobjects:Tolerance,Body,Ellipse,3dSolid,Region,andMline.IfusingADEQUERY(Preview),ADEQVIEWDWGS,orADEKEYVIEW,thismessagemeansADEdoesnotsupportaPreviewQueryofTolerance,Body,Ellipse,3dSolid,RegionandMline.

1508 kAdeAliasIsInUse Adrivealiasofthesamenamealreadyexists.

1509 kAdeActivateDrawingCancelled Thedrawingactivationoperationfailed.

1510 kAdeAttachDrawingCancelled Thedrawingattachmentoperationfailed.

Page 53: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

FeatureAlteration

1800 kAdeInvalidFeatureType Attempttosetaninvalidpropertyalterationtype.IfcallingAPIfunctionsade_altpsetproporade_altpdefine,checkforamistakeinpropertytype.

1801 kAdeNoListId Propertyalterationinternallistisinvalid.Callsupport.

1802 kAdeInvalidExpType Attemptmadetosetaninvalidpropertyalterationexpressiontype.Callsupport.

1803 kAdeNoExpression Propertyalterationinternalobjectisinvalid.Callsupport.

1804 kAdeTextCreationFailed Propertyalterationwasunabletocreateanewtextobject.Thismessageoccurswhenusingqueriesthatalterproperties.Checkexpressionsinthetextpropertyalterationdefinition.

1805 kAdeHatchCreationFailed Propertyalterationwasunabletocreateanewhatchobject.Thismessageoccurswhenusingqueriesthatalterproperties.Checkexpressionsinthehatchpropertyalterationdefinition.

1806 kAdeInvalidColor Invalidcolorpassedtopropertyalteration.Thismessageoccurswhenusingqueriesthatalterproperties.CheckexpressionsevaluatestoavalidAutoCADcolor.

1807 kAdeInvalidLayer Invalidlayername.Thismessageoccurswhenusingqueriesthatalterproperties.CheckexpressionsevaluatestoavalidAutoCADlayer.

Page 54: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1808 kAdeInvalidStyle Invalidstylename.Thismessageoccurswhenusingqueriesthatalterproperties.Checkexpressionsevaluatestoavalidstyle.

1809 kAdeInvalidJustification Theexpressionforjustificationinatextpropertyalterationdidnotevaluatetoavalidjustification.Thismessageoccurswhenusingqueriesthatalterproperties.CheckexpressionsevaluatestoavalidAutoCADjustification.

1810 kAdeInvalidScale

1811 kAdeNoRangeId ADEinternalobjectisinvalid.Callsupport.

Mapping

1900 kErrMapCoincPoint Coincidentpoints.IfusingADERSHEETorADETRANSFORMthismessagemeanseitheroldornewpointsarecoincident.Theymustbedifferent.

1901 kErrMapWrongScale Invalidscale.Callsupport.

1902 kErrMapTransform Can'ttransformentity.ADERSHEET,ADETRANSFORM,ADEQUERY,ADESAVEOBJSAnerrorappearedatthetimeofentitytransformation.Itishigh-levelerror.Theremustbeanothererrorinthestackwithmorespecificinformation.

Page 55: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1903 kErrMapWrongExtents Invalidentityextents.Ifyou'reusingADETEXTLOC,ADERSHEET,ADEQUERY,ADESAVEOBJS,orcallingAcDbEntity::getGeomExtents()methodyoumaygetthismessage.

1904 kErrMapWrongPoints Invalidpointsnumber.Ifyou'reusingADERSHEET,thismessagemeansthatthenumbersofoldandnewpointsaredifferent,orlessthan2.Dialogdoesn'tallowthis.

1905 kErrMapWrongSelSet Invalidselectionset.Callsupport.

1906 kErrMapWrongEntityName Invalidentityname.Theentityisopen.Forexample,ithasbeenreceivedfromtheAPI.

1907 kErrMapOpenEntity Can'topenentity.Theentityisopen.Forexample,anotherapplicationopenedtheentity.

1908 kErrMapUpgradeEntity Can'tupgradeopen.Entitymodificationoccurred.

1909 kErrMapMoveStretchPoints Can'tmodifystretchpoints.Callsupport.

1910 kErrMapEntityPoint Can'tmodifyentitypoints.Callsupport.

1911 kErrMapCmdecho Can'tchangeCMDECHOvariable.UsingADEFILLPOLYGmayproducethismessage.

Page 56: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1912 kErrMapCecolor Can'tchangeCECOLORvariable.UsingADEFILLPOLYGmayproducethismessage.

1913 kErrMapHatch Errorinhatchcommand.UsingADEFILLPOLYGmayproducethismessage.

1914 kErrMapWrongIntersectForPoints Can'tfindintersection.UsingADEQUERYorcallingAcDbentity::IntersectWith()methodmayproducethismessage.

1915 kErrMapWrongHandle Wrongentityhandle.Callsupport.

1916 kErrMapNotPolyline Entityisn'tpolyline.Callsupport.

1917 kErrMapIterator Can'tcreateiterator.Callsupport.

1918 kErrMapWriteXData Can'twriteXdata.EnsurethatXdatasizeis16KBorless.

1919 kErrMapBuffer Can'tcreatebuffer.Ifyou'reusingADEQUERY,tomakealocationqueryusingabufferfence,youmaygetthismessage.

1920 kErrMapStretchPoints Can'tgetstretchpoints.Ifyou'reusingADETRANSFORMorADEQUERYorcallingAcDbEntity::getStretchPoints()youmaygetthismessage.

Topology

Page 57: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Topology

2000 kErrTopInvalidName Invalidtopologyname.Occursduringtopologycreation.

2001 kErrTopExist Topologyalreadyexists.Occursduringtopologycreation.

2002 kErrTopBuildNet Errorbuildingnetworktopology.Occursduringtopologycreation.

2003 kErrTopBuildPolygon Errorbuildingpolygontopology.Occursduringtopologycreation.

2004 kErrTopBuildNode Can'tcreatenode.Occursduringtopologycreation.

2005 kErrTopBuildArc Can'tcreatelink.Occursduringtopologycreation.

2006 kErrTopBuildCntr Can'tcreatecentroid.Occursduringtopologycreation.

2007 kErrTopAPIReg Can'tregistertopologyAPI.OccursduringADEloading.

2008 kErrTopFuncNotAvail Functionisn'tavailable.Occursifyou'reusingtopologyfunctionsoftheAPI.

2009 kErrTopWriteData ErrorwritingXdata.Occursduringtopologycreationandmodification.

2010 kErrTopNotExist Topologydoesn'texist.Occursifyou'reusingtopologyfunctionsoftheAPI.

2011 kErrTopOverlayType Wrongoverlaytype.

2012 kErrTopMakeLayer Can'tcreatenewlayer.UsingADEDWGCLEANproducesthis

Page 58: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

message.

2013 kErrTopBlockNotExist Blockdoesn'texist.

2014 kErrTopNotOpenForWrite Topologyisn'topenforwrite.Occurswheneditingtopology.

2015 kErrTopOpenIrdTable Can'topenobjectdatatable.Occurswhenloadingandeditingtopology.

2016 kErrTopWrongIrdAttr Invalidobjectdatatable.Occurswhenloadingandeditingtopology.

2017 kErrTopLoaded Topologyisalreadyloaded.Occurswhenloadingtopology.

2018 kErrTopIncompleteElem Incompletetopologyelement.Occurswheneditingtopology.

2019 kErrTopInvalidColor Invalidcolornumber.OccurswhenusingADEDWGCLEANandcreatingtopology.

2020 kErrTopInvalidFlag Invalidflag.OccurswhenusingADEDWGCLEAN.

2021 kErrTopInvalidTolerance Invalidtolerance.OccurswhenusingADEDWGCLEANandcreatingtopology.

2022 kErrTopInvalidCorridor Invalidcorridorwidth.OccurswhenusingADEDWGCLEAN.

2023 kErrTopInvalidOffset Invalidoffset.Occurswhenusingbuffering.

2024 kErrTopInvalidHeight Invalidmarkerheight.OccurswhenusingADEDWGCLEAN.

2025 kErrTopInvalidMarkerType Invalidmarkertype.Occurswhen

Page 59: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

usingADEDWGCLEAN.

2026 kErrTopInvalidEntityType Invalidtypefornewentities.OccurswhenusingADEDWGCLEAN.

2027 kErrTopInvalidErrorType Invaliderrortype.OccurswhenusingADEDWGCLEAN.

2028 kErrTopIntersection Intersectionsdetected.Occurswhencreatingandeditingpolygontopology.

2029 kErrTopOverlayItself Can'toverlaytopologywithitself.

2030 kErrTopSourceDwgAccess Can'taccesssourcedrawing.

2031 kErrTopSourceDwgNotActive Sourcedrawingisn'tactive.

2032 kErrTopSourceDatabaseAccess Can'taccesssourcedrawingdatabase.

2033 kErrTopSourceObjectId Can'tgetobjectIDbyhandleinsourcedrawingdatabase.

2034 kErrTopNotLoaded Topologyisn'tloaded.

2035 kErrTopImplicitNode Nodeobjectdoesn'texistinnodetopology.

2036 kErrTopMisplacedNode Wrongnodecoordinates.

2037 kErrTopUnreferencedNode Nodeisn'treferencedinlinks.

2038 kErrTopUnexistentNode Linkreferencesnonexistentnode.

2039 kErrTopMismatchStartNode LinkhasinvalidIDatthestartnode.

2040 kErrTopMismatchEndNode LinkhasinvalidIDattheendnode.

Page 60: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2041 kErrTopMisplacedCentroid Wrongcentroidcoordinates.

2042 kErrTopMismatchLeftPoly LinkhasinvalidIDfortheleftpolygon.

2043 kErrTopMismatchRightPoly LinkhasinvalidIDfortherightpolygon.

2044 kErrTopUnexistentCentroid Centroidisn'tinsidepolygon.

2045 kErrTopMultiplyCentroid Polygonhasseveralcentroidsinside.

2046 kErrTopWrongPolyQty Somepolygonsareincorrect.

2047 kErrTopMismatchPolyArea Incorrectpolygonarea.

2048 kErrTopMismatchPolyPerimeter Incorrectpolygonperimeter.

2049 kErrTopOpenSourceDwgTopo Topologyloadedfromsourcedrawingscan'tbeopenforwrite.

2050 kErrTopOpenTempTopo Temporarytopologycan'tbeopenforwrite.

2051 kErrTopIdNotExist Currentdrawingdoesn'thaveODtablewithinformationaboutlastID.

2052 kErrTopEmpty Can'tcreateorloademptytopology.

2053 kErrTopWasModified TopologyobjectsweremodifiedbyAutoCADcommands.

2054 kErrTopMultiple Objectbelongstomultipletopologiesandcan'tbeerased.

2055 kErrTopCalculateOffset Can'tcalculateoffset.Usedefault.Occurswhenusingbuffering.

2056 kErrTopZeroOffset Zerooffset.Can'tbuildbuffer.

Page 61: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2057 kErrTopDifferentOffset Offsethasdifferentsignforsomeobjects.Can'tbuildbuffer.

2058 kErrTopInvalidSelSet Invalidselectionset.OccurswhenusingtheAPI.

2059 kErrTopCleanNotInit Cleanupmodelisn'tinitialized.OccurswhenusingtheAPI.

2060 kErrTopCleanNoGroup Thereisnocurrentgroup.OccurswhenusingtheAPI.

2061 kErrTopCleanInvalidIndex Invaliderrorindex.OccurswhenusingtheAPI.

2062 kErrTopCleanNoError Currenterrorisn'tset.OccurswhenusingtheAPI.

2063 kErrTopTraceLinkNotExist Linkdoesn'texistintracingmodel.OccurswhenusingtheAPI.

2064 kErrTopTraceNodeNotExist Nodedoesn'texistintracingmodel.OccurswhenusingtheAPI.

2065 kErrTopTraceNoPath Resultpathisn'tcalculated.OccurswhenusingtheAPI.

2066 kErrTopTraceInvalidIndex Invalidelementindex.OccurswhenusingtheAPI.

2067 kErrTopInvalidExpression Can'tprocessADEexpression.Occurswhenusingoverlay,buffer,dissolve,ortracingcommand.

2068 kErrTopLockedTable Can'twriteintotopologyODtable.Occurswhenusingdissolvecommand.

2069 kErrTopCreateTable Can'tcreateODtable.Occurswhenusingtopologycreation,

Page 62: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

overlay,buffer,ordissolvecommands.

2070 kErrTopCreateTableColumn Can'taddcolumntoODtable.Occurswhenusingtopologycreation,overlay,buffer,ordissolvecommands.

2071 kErrTopTraceNodesEqual Startandendnodesarethesame.Occursdoingshortestpathtracing.

2072 kErrTopTracePathNotExist Emptypath.Occursduringshortestpathtracing.

2073 kErrTopTraceFloodNotExist Emptypath.Occurswhentracingfloods.

2074 kErrTopRenameDisabled Can'trenametopology,becausecurrentdrawinghasqueriedobjectswithOD.

2075 kErrTopDeleteDisabled Can'tdeletetopology,becausecurrentdrawinghasqueriedobjectswithOD.

2076 kErrTopInvalidExtents

TopologyAPI

2100 kAdeTopApiErrWrongInput Missingorinvalidparameter.

2101 kAdeTopApiWrongId InvalidID.

Tracing

2150 kAdeTopSprErr Tracingerror.Occursduringtopologytracing.

QueryDefinition

Page 63: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

QueryDefinition

2200 kErrUnexpectedBuffChar Invalidcharacterencounteredwhilereadingthequerydefinitionfromthedrawing.Optionsarea)Recoverthedrawingb)Defineandsaveanewquerydefinitioninthedrawing.

2201 kErrInvalidIndex Aninvalidlinenumberwasspecifiedforeithergroupingorungroupingofquerylines.Specifythecorrectlinenumberforgroupingorungroupingthelines.

2202 kErrInvalidQueryLine Oneormorequerylineshavebeenincorrectlydefined.Mayoccurwhenyouincorrectlyplaceaparenthesisoranoperatorinaqueryline.

2203 kErrInvalidName Eitheraqueryoraquerycategorynameisinvalid.EnsurethatthequeryorcategorynameconformtotheAutoCAdsymbolnamespecifications.

2204 kErrEntryAlreadyExists Eitherthequeryorthequerycategorynamealreadyexistsinthequerylibrary.Ensurethatthequerynameisuniquewithinthequerylibrary.

2205 kErrEntryInOtherCategory Thequerynamespecifiedalreadyexistsinanothercategoryinthequerylibrary.Ensurethatthequerynameisuniquewithinthequerylibrary.

2206 kErrEntryAndFileAlreadyExist Thefilenamespecifiedforsaving

Page 64: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

theexternalqueryalreadyexists.Chooseadifferentfilename.

2207 kErrASIConnectFailed TheconnectiontotheASIenvironmentrequiredfortheSQLquerywasnotmade.UseASEtoconnecttotheenvironmentbeforeattemptingtoperformtheSQLquery.

2208 kErrASIStmtPrepareFailed ThecalltoCAsiExecStm::Preparefailed.correctthetablenameortheSQLstatementspecified.

2209 kErrASICsrAllocFailed ThecalltoCAsiCsr::Allocatefailed.LookattheASIerrordisplayed.

2210 kErrASICsrOpenFailed ThecalltoCAsiCsr::Openfailed.LookattheASIerrordisplayed.

2211 kErrInvalidDOName AninvalidEnvironment,SchemaorCatalognamewasspecified.SetthecorrectEnvironment,Catalog,andSchemanames.

2212 kErrLPInitFailed ThecalltoCAseLinkPath::initfailed.LookattheASEerrordisplayed.

2213 kErrColNotFound UsedfortheSQLOrder-bydialognowobsolete.Callsupport.

2214 kErrQDefNotInTM TheCAdeQueryDefobjectwasnotappendedtotheTransactionManager.Internalerror.

2215 kErrQryDefnExists Aquerydefinitionalreadyexistsandanewonecannotbeloaded.Cleartheexistingquerydefinition

Page 65: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

beforeloadinganewone.

2216 kErrInvalidOperator Invalidoperatordefinedinquerydefinition.Thespecifiedcomparisonoperatorisincompatiblewithoperandtypes.Donotuse>withthepointtype.Checkthequerydefinitionandchangeeithertheoperatororoperandtype.

2217 kErrInvalidPtrnOperator Invalidoperatordefinedinquerydefinitionforpatternvalue.Ifvalueoperandisdefinedaspattern,only"="comparisonoperatorcanbeused.Checkthequerydefinitionandchangeeitheroperatororoperandvalue.

2218 kErrInvalidField Non-existentobjectdatafieldspecified.Thiserroroccurswhentheuserspecifiesthewrongobjectdatafieldnameforatable(ifthereisnosuchfieldinthespecifiedtable)inthequerydefinitionandexecutesthequery.Checkquerydefinitionandtablesandcorrectthemistake.

2219 kErrInvalidNotBranch

2220 kErrInvalidBranch

2221 kErrUndefinedValue

2222 kErrInvalidLocationType

2223 kErrCantLoadExternQuery

QueryManager

Page 66: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

QueryManager

2300 kErrIntersectFailed AcalltoCAseLinkSel::intersectPartialKeyfailed.LookattheASEerrordisplayed.

2301 kErrNoTemplate Thequerytypewasspecifiedasreportbutnoreportoptionsweredefined.Definereportoptions.

2302 kErrASIStoreValueFailed AcalltoCAsiData::storeValuefailed.LookattheASIerrordisplayed.

2303 kErrASIGetValueFailed AcalltoCAsiData::getValuefailed.LookattheASIerrordisplayed.

Utility

2400 kErrLicFatal FatalerrorinADElicense.Callsupport.

2401 kErrFileNotFound Can'tfindassociateddocument.OccurswhenusingADEDOCVIEW.

2402 kErrPathNotFound Can'tfindexecutablefile.OccurswhenusingADEDOCVIEW.

2403 kErrBadFormat Syntaxerrorinthecommandline.OccurswhenusingADEDOCVIEW.

2404 kErrConvtErr ErrorconvertingADE1.0datatoADE2.0data.OccurswhenusingADECONVERT.

DataDialogs

2450 kErrIRDMismatch

2451 kErrIRDInvalidName

2452 kErrIRDTableExists

2453 kErrInvalidTableName

Page 67: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2454 kErrInvalidAttrName

2455 kErrTopoName

2456 kErrQueriedAndNotNew

2457 kErrNotAdministrator

GenLink

2500 kErrTagNotFound

2501 kErrTagValueAbcent

2502 kErrIllegalFormat

2503 kErrColMoreThanOne

Environment

2600 kErrInitEnv AnerroroccurredduringtheinitializationofADE.Thecauseofthiserrormaybeduetoerrorsinloading/initializingADEuserpreferences,systempreferences,logfile,oruserlist.

2601 kErrCantFindAdeExePath

2602 kErrINIWrite

2603 kErrInvalidUserName Theusernamespecifieddoesnotexistintheuserlist.UseausernamethatalreadyexistsintheuserlistordefineanewoneusingUserAdministration.

2604 kErrLoadUserList

2605 kErrSaveUserList

Page 68: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2606 kErrInvalidPswd Thepasswordspecifieddoesnotmatchtheonespecifiedintheuserlistforthisuser.Usethecorrectpassword.

Rx

2700 kErrRxAseLoad ASEisn'tloadedCan'tinitializeASEAPI.

2701 kErrRxAseInit ObjectDatamoduleisn'tloaded.

2702 kErrRxIrdLoad Can'tinitializeObjectDataAPI.

2703 kErrRxIrdInit Specifiedcoordinatesystemcategorynotfoundinthelibrary.Callsupport.

Projection

2800 kErrNoProjCatFound Specifiedcoordinatesystemcategorynotfoundinthelibrary.Callsupport.

2801 kErrNoDatumFound Specifiedcoordinatesystemdatumnotfound.Callsupport.

2802 kErrNoElipFound Ellipsoidnotfoundintheellipsoidlist.Callsupport.

2803 kErrNoCoordFound SpecifiedCoordinateSystemnotfound.Callsupport.

2804 kErrFaileOpenDatumFile Can'topenprojection.mp3file.OccurswhenloadingADE.

2805 kErrFaileOpenElipFile Can'topenellipsefile.OccurswhenloadingADE.

2806 kErrNoneCoord Internalcodetoset"None"projectiontothedrawing.Callsupport.

Expression

Page 69: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2900 kErrNoExpressionFound Emptyexpressionisspecified.Callsupport.

2901 kErrGetPropFail Thisisaninternalcodetoshowthatentityhasnospecifiedproperty.Callsupport.

2902 kErrExpEvalFail ADEfailstoevaluateexpression.Occurswhenexecutingquerywithpropertyalterationandexecutingapropertyquery.

2903 kErrExpMissingQuote QuotesmismatchedinSQLexpression.OccurswhenexecutingaSQLqueryandaquerywithSQLpropertyalteration.AlsooccurswhenusingADECONVERT.

2904 kErrExpMissingCParen Parenthesismismatched.Occurswhenexecutingaquerywithfeaturealterationandexecutingapropertyquery.

2905 kErrExpExceedThreeOper Morethanthreeoperandsarespecified.Occurswhenexecutingaquerywithpropertyalterationandexecutingapropertyquery.

2906 kErrRngTabNameExist Rangetablewithspecifiednamealreadyexists.Callsupport.

2907 kErrLpnInvalid

2908 kErrLpnNotFound

2909 kErrRangeInvalidElse

FormoreExpressionerrors,whichbeginat�15,click .

Index

Page 70: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

3000 kErrInvalidIndexVersion Theversionoftheindexinthedrawingisinvalid.Theoptionsare:1)Regeneratetheindexusingdrawingmaintenance2)Removetheindexusingtheindexremovalutilityandthenre-generatetheindex.

3001 kErrIndexOutOfDate Theindexinthedrawingisout-of-date.Regeneratetheindexusingdrawingmaintenance.

3002 kErrTypeAllObjects

3003 kErrTypeNoOneObject

Validation

3100 kErrWrongSymbolName

3101 kErrWrongSymbol

3102 kErrWrongStrLength

3103 kErrDirDoesNotExist

3104 kErrDirReadOnly

3105 kErrAccessDenied

3106 kErrFileDoesNotExist

3107 kErrFileAlreadyExists

3108 kErrFileOpenFailed

3109 kErrFileReadOnly

3110 kErrInvalidString

3111 kErrOutOfRange

Page 71: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

3112 kErrWrongColor

3113 kErrIncorrectParameters OneofADEvalidationmethodsrecognizedincorrectinputparameters.ThiserrorisaninternalADEerror.

3114 kErrFileOpenLimit

3115 kErrShareViolation

3116 kErrNetAccessDenied

3117 kErrPathDoesNotExist

FileLocking

3200 kErrDwkFileDoesNotExist ADElockfileislocked.OccurswhenusingADEDRAWINGSandADEQUERYcommandsandwhenADEisrunninginamulti-userenvironment.

3201 kErrOpenDwkFileFailed ADEwasunabletoopenthe.DWKlockfile.Callsupport.

3202 kErrFileLockedByAcad Attempttoremoveauserwhodoesnotexistfromthelockfile.Callsupport.

3203 kErrOldMapLockFile ADEwasunabletocreatethe.DWKlockfile.Callsupport.

3204 kErrFileIsNotDwk ADEtriedtolockafileforwritethatwasalreadylockedforread.Callsupport.

3205 kErrSpecifiedUserDoesNotExist ADEtriedtolockafileforreadthatwasalreadylockedforwrite.Occursduringqueryoperationsinamulti-userenvironment.

Page 72: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

3206 kErrCreateDwkFileFailed ADEtriedtoopenandreadafilethatwasnotavalid.DWKfile.Callsupport.

3207 kErrFileIsLockedForRead ADEwasunabletounlockthelockfile.Callsupport.

3208 kErrFileIsLockedForWrite ADEtriedtoattachafilethatisalreadyopenbyAutoCAD.OccurswhenusingADEDRAWINGSwithATTACHoperationsifthefileisopeninanAutoCADproject.

3209 kErrInvalidLockStateSpecified ADEinternalobjectisinvalid.Callsupport.

3210 kErrNotOwnerOfWLH ADEtriedtoremoveawritelockwhentheuserdidnothaveawritelock.Callsupport.

3211 kErrUserIsNotWriter

3212 kErrUserIsNotReader

3213 kErrUserHasReadLock

3214 kErrLockFileIsFull

3215 kErrDwgFileDoesNotExist ADEtriedtounlockafilebutthe.DWKfilewasmissing.Occursifthe.dwkfilewaserasedafterafilewasattached.

3216 kErrNotAnADELockFile ADEinternalobjectisinvalid.Callsupport.

3217 kErrFileMayHaveBeenModified Existing.DWKfiledoesnotbelongtoADE.thelockfileexistsandcanbereadbyADE,butADEdoesnotownthefile.

Page 73: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

3218 kErrFileHasLocks ADEtriedtoremovealockfilebutitwasnotfound.Occursifthe.dwkfilewaserasedafterafilewasattached.

UnicodeSupport

4000 kAdeUnicodeInsufficientBufferToConvert

4001 kAdeUnicodeInvalidFlagsToConvert

4002 kAdeUnicodeInvalidParameterToConvert

4003 kAdeUnicodeNoTranslation

4004 kAdeUnicodeCodePageNotAvailable

Double-ByteSupport

4005 kAdeNoMBCSAllowed

Page 74: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ErrorTypes

Errorsaregroupedbyerrortype.

Youcangetanerror'serrortypebypassingitsstackindex(0=firsterror)toade_errtype.

00 kAdeNoMessage Errorconditiondoesnotexist.

01 kAdeWarning ADE(AutoCADDataExtension)executionwarning

02 kAdeError ADEexecutionerror

03 kAseWarning ASE(AutoCADSQLExtension)executionwarning

04 kAseError ASEexecutionerror

05 kAcWarning AutoCADexecutionwarning

06 kAcError AutoCADexecutionerror

07 kAsiWarning ASI(AutoCADSQLInterface)executionwarning

08 kAsiError ASIexecutionerror.

09 kIRDWarning Extendedobjectdata(Xdata)warning

10 kIRDError Xdataerror

13 kMapError AutoCADMapexecutionerror

Page 75: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

14 kMentorError

15 kApplicationError Operatingsystemlevelapplicationerror

16 kDiagMessage Diagnosticmessagereturned.

Page 76: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ConvertingCoordinates

Convertingpointcoordinatesfromonegeo-referencedsystemtoanother.

KeepinmindthatanyCartesiancoordinatepairyouselectinageo-referencedcoordinatesystemcorrespondstoapointonthesurfaceoftheearth.Thisfactdefinesarelationbetweenthecoordinatepairsinonecoordinatesystemandthecoordinatepairsinanyother,solongasthepointinquestionactuallyexistsinbothsystems.Inotherwords,solongasthecoordinatesystemshavearegionofintersection,andthepointinquestionisinit.

Toconvertthecoordinatesofapointfromonegeo-referencedcoordinatesystemtoanother

1. Definea"source"coordinatesystemwithade_projsetsrc.2. Definea"destination"coordinatesystemwithade_projsetdest.3. Passacoordinatepairtoade_projptforward.

Thefunctionassumesthatthecoordinatepairyoupasstoitisapointinthesourcesystem,anditreturnsthecorrespondingcoordinatepairinthedestinationsystem.Ifthereisnocorrespondingcoordinatepair,itreturnsnil.

Toconvertintheotherdirection,useade_projptbackward.

Youcanspecifycoordinatetriplets,butifyoudo,theZvalueisignored.

Page 77: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PlottingaMap

Plottingisthelaststageinpresentingmapdata.

Thefollowingsampleoutlinesthestepsrequiredtosetupandplotamapset.

Toplotamap1. SetthePlotternameforLayout1usingtheAutoCAD�ActiveX�

interface.

(vl-load-com)(setqacadObject(vlax-get-Acad-object))(setqacadDocument(vla-get-ActiveDocumentacadObject))(setqactiveLayoutObject(vla-Get-ActiveLayoutacadDocument))(setqpSpace(vla-get-PaperSpaceacadDocument))(setqlayout(vla-get-layoutpSpace))(vla-put-confignamelayout"\\\\PlotServer\\HpLaserjet4100SeriesPcl")

2. AddadrivealiastothelistsothatAutoCADMapcanfindthedrawingsusedtoexecutetheplot.

(ade_aliasadd"LISP_SAMPLE""C:\\Lisp\\Drawings\\PlotMapSet")

3. Defineaboundarydrawingoruseanexistingone.ThisexampleusesanexistingdrawingnamedSystem-Grid.dwg.

Theboundarydrawingmustcontainatleastoneclosedpolylinewithobjectdata.Eachclosedpolylineisadivisionofthemap,andthesheet

Page 78: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

nameisattachedtoitasobjectdata.

4. Attachthedrawingsforthisplotsetandtheboundarydrawing.

(ade_dsattach"LISP_SAMPLE:\\Landbase-Shared.dwg")(ade_dsattach"LISP_SAMPLE:\\Water-Facilities.dwg")(ade_dsattach"LISP_SAMPLE:\\System-Grid.dwg")

5. Definea"Draw"modequerywhichselects"ALL"objectsintheattacheddrawings.

(ade_qryclear)

(ade_qrydefine'("""""""Location"("All")""))

(ade_qrysettype"draw")

6. Savethequeryinternaltotheproject.

(ade_qrysave"PlotQueries"'(("name""TruckBook-100")("saveoption"2)))

7. Definealayoutblock,(titleblock)oruseanexistingone.Thelayoutblockmustcontainatleastoneviewportandoptionallyareferenceviewport.Ifthelayoutblockcontainsanattributewhichrepresentsamapnameorsomeothertypeofareanamingconvention,thatnamecanbemappedfromtheboundarydrawingtothisattribute,infactanyobjectdataassociatedtoaboundarycanbemappedtoanattributeonthelayoutblock.Thissampledoesnotcontaincodeforcreatingordefiningthislayoutblock.

8. Createanewplotset.

Page 79: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(map_pltCurrDef"TruckBook-100")

9. DefinePlotSetvariables

Definethedrawingset:

(setqdwgs_list(list"LISP_SAMPLE:\\Landbase-Shared.dwg""LISP_SAMPLE:\\Water-Facilities.dwg"))(map_pltCurrSet"dwgs"dwgs_list)

Definetheplotternameviathelayout:

(map_pltCurrSet"pnam""Layout1")

Definethelayoutblockname:

(map_pltCurrSet"block""TITLE-A")

Definethelayoutblocksviewportlayer:

(map_pltCurrSet"vlayer""TB-BORDER")

Definetheobjectdatatablecontainingboundaryinformation:

(map_pltCurrSet"bnamt""MAPSYS-MAP")

Definetheboundaryfieldname:

(map_pltCurrSet"bnamf""MAPNAME")

Page 80: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Definetheboundaryobjectdatafieldtoblockattributeinlayoutmapping:

(map_pltCurrSet"atts""MAPNAME")

Definethelayoutblocksreferenceviewportflag:

(map_pltCurrSet"kflg"nil)

Definethelayoutblockskeyviewportlayer:

(map_pltCurrSet"klayer""")

Definethedisplaylayersinthereferenceviewport:

(map_pltCurrSet"kdispl""")

Definethelayerstofreezeinmainviewport:

(map_pltCurrSet"vdispl""0")

Definethequerycategory:

(map_pltCurrSet"qcat""PlotQueries")

Definethequeryname:

(map_pltCurrSet"qnam""TruckBook-100")

Page 81: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Definetheboundarydrawing:

(map_pltCurrSet"bdwg""LISP_SAMPLE:\\System-Grid.dwg")

Definetheboundarylayer:

(map_pltCurrSet"blyr""MAPEDGE")

Definetheboundaryfieldname:

(map_pltCurrSet"bodfs""MAPNAME")

Specifytheboundaries:

(setqbndry_list(list"101""102"))(map_pltCurrSet"bnds"bndry_list)

Definetheplottospecifiedscaleflag:

(map_pltCurrSet"sflg"nil)

Definetheplotscale:

(map_pltCurrSet"scale""1:750")

Definetheclipobjectsagainstboundaryflag:

(map_pltCurrSet"clip"T)

Page 82: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Definetheplottheboundaryflag:

(map_pltCurrSet"pbnd"T)

10. Appendthecurrentplotsetdefinitiontotheplotsetlist.

(map_pltCurrSave)

11. Writethecurrentplotsetdefinitiontotheplotdefinitiondictionarywithinthecurrrentproject.

(map_pltDefSave)

12. Performacursorychecktoseeiftherequiredattributeshavebeenset,thisisoptional.

(if(not(map_pltDefValid"TruckBook-100"))(prompt"\nERROR:Plotsetinvalid."))

13. Performamoreextensivecheckthatmakessurethatnoerrorsoccurwhenplottingtakesplace,thisisoptional.

(map_pltdefverify"TruckBook-100")

14. Initializetheplottingenvironment.See(map_pltInit)formoredetailonthisfunction.

(map_pltInit)

Page 83: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

15. Displayasinglesheetwithintheplotsetbasedonaboundaryvalue,thenplotifsuccessful.Note,youmustalwayscallmap_pltdisplay()beforecallingmap_pltPlot().

(map_pltDisplay"101")

;Visuallychecktheplotsetdisplay.Ifitiscorrect,plotit.(initget"YesNo")(setqanswer(getkword"\nDisplayiscorrectYes/No?"))(if(or(nullanswer)(equalanswer"Yes"))(map_pltPlot))

16. Restorethedisplayenvironmenttoitsstatebeforethelastexecutionofthemap_pltDisplay().

(map_pltRestore)

17. RestorethedataextensionoptionsandAutoCADsettingsalteredbymap_pltInit().

(map_pltCleanup)

Page 84: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CompletingaTopology

Thisprocedurecreatesapartialtopologyandusesmap_topocompletetoaddthemissingelementstocompleteit.

Tocompleteatopology1. Createapolygontopologyandsaveittoafile.

2. Startanewprojectandattachthedrawingusingade_aliasadd,ade_dsattach,andade_dwgactivate.

3. Queryinsomeofthetopology'sobjectstocreateapartialtopology.Usequeryfunctions.

(ade_qryclear);clearallqueries(ade_qrysettype"draw");drawqueryresults(setqpt1(list2.91238.85130.0))(setqpt2(list5.91341.16340.0))(setqpt3(list10.79311.73540.0))(setqpt4(list10.03718.87420.0))(setqlst(list"polygon""crossing"pt1pt2pt3pt4))(setqqry_id(ade_qrydefine"""""""location"lst""))(if(nullqry_id)(prompt"\nERROR:Querydefinitionfailed.")(progn(prompt"\nQueryinginpartofthepolygontopology.")(setqresult(ade_qryexecute))(if(nullresult)

Page 85: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(prompt"\nExecutionofqueryfailed."))))

4. Loadthetopologyintomemoryfromtheprojectdrawing.

(setqresult(tpm_acloadnamenil))

5. Openthetopologywithreadaccess.

(setqtpm_id(tpm_acopen"test"nil))

6. Testthetopologyforcorrectnessandcompleteness.

(if(tpm_infocorrecttpm_id)(prompt"\nTopologyiscorrect.")(prompt"\nTopologyisnotcorrect."))(if(tpm_infocompletetpm_id)(prompt"\nTopologyiscomplete.")(prompt"\nTopologyisnotcomplete."))

7. Optionally,youcangettopologystatistics.Youcanaddcodetodisplaythestatistics.

(setqlst(map_topostattpm_id))(if(nulllst)(prompt"\nERROR:Unabletogetstatistics.")(progn(prompt"\nNumberofnodes:")

Page 86: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(princ(cdr(assoc"node_count"lst)))(prompt"\nNumberoflinks:")(princ(cdr(assoc"link_count"lst)))))

8. Closethetopology.

(tpm_acclosetpm_id)

9. Usemap_topocompletetobringinthemissingobjectstocompletethetopology.

(map_topocomplete"test")

10. Repeatsteps5through7totestthetopologyforcompleteness.11. Unloadthetopology.

>

(tpm_acunload"test")

Page 87: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DrawingCleanup

Youmustcleandrawingobjectsbeforebuildingatopologywiththem.

Drawingcleanupextendsundershoots,snapsclusterednodes,removesduplicates,simplifieslinearobjects,andcorrectsothererrors.

Let'slookatthisintwophases,preparingthecleanupmodel,whichendswithacalltotpm_cleaninit,andexecutingthecleanup,whichbeginswithacalltotpm_cleanstart.

Topreparethecleanupmodel

1. Allocatememoryforthecleanupmodel.Usetpm_cleanalloc.

(setqclean_id(tpm_cleanalloc))

2. Allocatememoryforcleanupvariables,whichspecifypropertiesforthecleanupprocess.Thevariablesareinitializedtotheirdefaultvalues.Usetpm_varalloc.

(setqclean_var_id(tpm_varalloc))

Ifyouwillbespecifyinganexplicitlistofcleanupactions(youcreateandmanagethislistwithcallstotpm_cleanactionlistinsandrelatedfunctions),alsoallocatememoryforcleanupactionvariables,whichspecifypropertiesforindividualactions.Againusetpm_varalloc.

Page 88: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqaction_var_id(tpm_varalloc))

3. Getaselectionsetofobjectstobecleaned(theincludeset).

(prompt"\nSelectobjectstoclean.")(setqss_clean(ssget))

Youcanalsogetaselectionsetofobjectstobeanchored(theanchorset).Anchoredobjectsarenotrepositionedbythecleanupprocess,butremainfixedwhileothersarerepositionedaroundthem.

(prompt"\nSelectobjectstoanchor.")(setqss_anchor(ssget))

Thessgetfunctionpromptstheusertoselectobjectsandreturnsaselectionset.

4. Setcleanupvariablesusingtpm_varsetwiththeclean_var_idthatyouallocatedinstep2.Afewofthesevariablesspecifycleanupactions,butmostofthemspecifyhowcleanupactionswillbeperformed.

;setsomecleanupvariables(tpm_varsetclean_var_id"MAINTAIN_MARKERS"1)(tpm_varsetclean_var_id"CLEAN_TOL"4.21)(tpm_varsetclean_var_id"ANCHOROBJS_LAYERS""Layer1")

Beforesettingcleanupvariables,youcanloadacleanupprofileifyousavedonepreviously,andinthatwaysetmanyvariablesatonce.Usetpm_cleanprofileload.

(setqresult(tpm_cleanprofileloadclean_var_id"C:\\profile.dpf"))

Page 89: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Ifyouspecifyanexplicitlistofcleanupactions,notethatthosewillbetheonlyactionsperformed.CleanupactionsspecifiedbythevariablesNODE_ERROR,LINK_ERROR,andGENERALIZEwillbeignored,aswellasanysettingspecifictothemonly,suchasCORRIDOR's,whichdefinesthetoleranceforGENERALIZE.

Usinganactionlististhebestwaytospecifycleanupactions,becauseyoucanspecifytheorderinwhichtheyexecute,andyoucanincludethesameactionmorethanonce.Usingvariablestospecifycleanupactionsisanoldertechnique,whichisstillsupportedforthesakeofolderscripts,butitisdeprecatedfromAutoCADMap6onward.

NoteWhenyouinserttheSimplifyObjectsaction(cleangrouptype128),itisalwayslistedfirst,andyoucannotinsertitmorethanonce.

Withanexplicitlistofcleanupactions,notethatcertainindividualactionscanhaveindividualtolerancesettings(andinsomecases,othersettingsalso).SeeCleanupActionVariables.Whenyouareabouttoinsertanactionintotheactionlist,youcanusetpm_varsetwiththeaction_var_idthatyouallocatedinstep2tosetvariablesforthisactionbeforecallingtpm_cleanactionlistins.Youcancontinuallyresetandreusethesamesetofcleanupactionvariableswitheachactionthatyouinsert.

;insertacleanupactionintotheactionlist;firstsetatoleranceforthisaction(tpm_varsetaction_var_id"CLEAN_TOL"2.2);withtheactionlistreferencedbyclean_var_id...;*insertatthefirstposition(position0);*insertEraseShortObjects(action1);*withtheoptionsreferencedbyaction_var_id(tpm_cleanactionlistinsclean_var_id01action_var_id)

Atanypointwhileyouaresettingcleanupvariables,orafteryouhavefinished,youcansavethecurrentcleanupprofileusing

Page 90: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanprofilesave.

(setqresult(tpm_cleanprofilesaveclean_var_id"C:\\profile.dpf"))

NotethatsavedprofilesareXMLfiles.Youcanvieworedittheminatexteditorasyoucanwithsavedqueries(whichareAutoLISPscripts).SeeEditingQueryFiles.

5. Calltpm_cleaninittoaddcleanupvariablesandtheselectionsetofobjectstocleantothecleanupmodel.

(setqresult(tpm_cleaninitclean_idclean_var_idss_clean))

Ifyouhavecollectedaselectionsetofobjectstobeanchored,firstcalltpm_cleaninitanchorsetbeforecallingtpm_cleaninit.

(setqresult(tpm_cleaninitanchorsetclean_idclean_var_idss_anchor))

Thecleanupmodelisnowcomplete.

Toexecutethecleanup

1. Beginthecleanupprocesswithtpm_cleanstart.

(setqresult(tpm_cleanstartclean_id))

2. Executecleanupactions(processcleanupgroups)untilcleanupiscomplete.Witheachcleanupgroup,witheacherror,markandfixit.

(tpm_cleangroupnextclean_id)

Page 91: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(while(not(tpm_cleancompleteclean_id));counterrorsinthisgroup(setqi(tpm_cleangroupqtyclean_id));processeacherror(while(>=(setqi(1-i))0);withthecurrenterror(tpm_cleanerrorcurclean_idi);markit(tpm_cleanerrormarkclean_id);cleanit(tpm_cleanerrorfixclean_id))(tpm_cleangroupnextclean_id))

3. Updatethedrawingwithtpm_cleanend.

(tpm_cleanendclean_id)

Toclearthecleanupmodelwithoutupdatingthedrawing,usetpm_cleancancel.

Page 92: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

BuildingaTopology

Thefollowingstepsdescribebuildingatopology.

Theresultingtopologyisloadedbutnotopen.

NoteForsimplicity,cleaningdrawingobjectsbeforebuildingthetopologyisomitted.SeeDrawingCleanup.

Tobuildatopology1. Allocatememoryfortopologyvariables.Thevariablesareinitializedto

theirdefaultvalues.

(setqvar_id(tpm_varalloc))

2. Setthetopologytype,name,anddescription.Thisexamplecodepromptsforthetopologytype.

(initget"noDeNetworkPolygon")(setqtyp(getkword"Selecttopologytype(noDe/Network/Polygon)<Exit>:"))(if(nulltyp)(prompt"\nNotopologytypeentered."))

3. Thenextstepistoincludeobjectsforthetopology(nodes,links,centroids),dependingonthetopologytype.Thiscoderepeatsthreetimestoincludeeachobjecttype.

Page 93: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Afterpromptingfornodeobjects,asshownhere,thisexamplepromptsforlinkandcentroidobjects.

Setupafiltertogettheobjectsyouwant.Someautomaticfilteringisperformedbyssget,whichplacestheobjectsinanAutoCADselectionset.Notethatyoumustincludedifferentobjecttypesforeachtypeoftopology.

;NodeobjectsarePOINT,TEXT,andINSERT(cond((=indx1)(setqfilter(list(cons-4"<OR")(cons0"POINT")(cons0"TEXT")(cons0"INSERT")(cons-4"OR>")))(prompt"\nSelectnodeobjects.")(setqss_nod(ssgetfilter)))

;LinkobjectsareLINE,PLINE,ARC,andCIRCLE((and(=indx2)(or(=typ"NETWORK")(=typ"POLYGON")))(setqfilter(list(cons-4"<OR")(cons0"LINE")(cons0"PLINE")(cons0"ARC")(cons0"CIRCLE")(cons-4"OR>")))(prompt"\nSelectlinkobjects.")

Page 94: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqss_lnk(ssgetfilter)))

;CentroidobjectsarePOINT,TEXT,andINSERT((and(=indx3)(=typ"POLYGON"))(setqfilter(list(cons-4"<OR")(cons0"POINT")(cons0"TEXT")(cons0"INSERT")(cons-4"OR>")))(prompt"\nSelectcentroidobjects.")(setqss_ctr(ssgetfilter))));cond);repeat

4. Buildthetypeoftopologyyouselectedinstep2,usingtpm_mntbuild.Thissampleusesaconditionaloperationtobuildthetopology.

Fortype1,anodetopology,tpm_mntbuildincludesonlynodes.

(cond((=typ"NODE")(setqresult(tpm_mntbuildvar_idnamedesc1ss_nod)))

Fortype2,anetworktopology,itincludesnodesandlinks.

((=typ"NETWORK")(setqresult(tpm_mntbuildvar_idnamedesc2ss_nodss_lnk)))

Page 95: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Fortype3,apolygontopology,itincludesnodes,links,andcentroids.

((=typ"POLYGON")(setqresult(tpm_mntbuildvar_idnamedesc3ss_nodss_lnkss_ctr))

Ifnoerrorsoccur,thetopologyisnowcomplete.

Page 96: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

OpeningaTopology

Thefollowingnumberedstepsdescribehowtoloadandopenatopologyforreadaccess,getinformationaboutthetopology,andthencloseit.

Toopenatopology1. Promptforthetopologyname.

(setqname(getstring"\nEnterthetopologyname"))

2. First,useTopologyAccessfunctionstoseeifthetopologyisalreadyloadedand,ifnot,loadit.

Checktoseeifthetopologyisloadedwithtpm_acexist.

(setqresult(tpm_acexistnameTT))(ifresult(prompt"\nTopologyisalreadyloaded."))

UsingTforboththesourceandloadedparameterscausestpm_acexisttocheckfortopologiesinbothcurrentandsourcedrawingsthatarealreadyloadedinmemory.

3. Ifitisnotloaded,loaditwithtpm_acload.

(setqresult(tpm_acloadname))

Page 97: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Youcanaddcodeheretohandleerrorsorannouncesuccessfulloading.

4. Openthetopologyforreadaccess.Thetpm_acopenfunctionopensatopologyandcreatesanewtopology_ID(*)thatprovidesaccesstoit.Usingthenilvalueforthewrite_accessparametersetsaccesstoread.

(setqtpm_id(tpm_acopennamenil))

5. UseTopologyInformationfunctionstogetinformationaboutthetopology.

Getthedescriptionofthetopologywithtpm_infodesc.

(prompt(strcat"\nTopologydesc:"(tpm_infodesctpm_id)))

Getthetypeofthetopologywithtpm_infotype.

(prompt(strcat"\nTopologytype:"(itoa(tpm_infotypetpm_id))))

Testthetopologytoseeifitiscorrectwithtpm_infocorrect.

(if(tpm_infocorrecttpm_id)(prompt"\nTopologyiscorrect.")(prompt"\nTopologyisnotcorrect."))

Testthetopologytoseeifitiscompletewithtpm_infocomplete.

(if(tpm_infocompletetpm_id)

Page 98: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(prompt"\nTopologyiscomplete.")(prompt"\nTopologyisnotcomplete."))

Gettheversionofthetopologywithtpm_infoversion.

(prompt(strcat"\nTopologyversion:"(tpm_infoversiontpm_id)))

6. Closethetopology.

(tpm_acclosetpm_id)

Whenyouusetpm_acopentoopenortestthestatusofatopology,alwaysclosethetopologywithtpm_acclose.Otherwise,youruntheriskofleavingthetopologyopenwithmultipleIDspointingtoit.

Page 99: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

EditingQueryFiles

Ifyouhavequeriesthatyouuseoften,youcansavetheminqueryfiles,whichyoucanmodifyandreuseasyouneedthem.Modifyinganexistingqueryratherthancreatinganewonecansaveyoutime.Thissectionshowsthecontentsofsometypicalqueryfiles.

LocationQuery

PropertyQueries

LocationQuerywithPropertyAlteration

LocationQuerywithPropertyAlteration:BeforeandAfter

ComplexQuery

Page 100: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Colors

ColorscanbespecifiedorreturnedasAutoCADcolorindexes(ACIs)ortruecolors.

Bytruecolorswemean24-bitcolor:threeRGBcomponents,8bitseach,withnoalphacomponent(thatis,notransparencyvalue).

ACIColors

ThevalidACIformatsare

ColorIndexes,integerstringsfrom0through256.Forexample,"123".Notethatindexes0and256donotspecifycolorsliterally,as1through255do,butlogically.See"LogicalColors"below.

ColorNames,whichcorrespondtoindexes1through7.Thecolornamesarered,yellow,green,cyan,blue,magenta,andwhite.Forexample,"yellow"(alwaysdouble-quoted).

LogicalColors,whichcorrespondtoindexes0and256.ThelogicalcolorsareByBlockandByLayer.Forexample,"ByBlock"(alwaysdouble-quoted).NotethatByBlockandByLayercanreturntruecolorsorACIs.

FormoreinformationaboutACIcolors,seeColorIndexColors.

TrueColors

Thevalidtrue-colorformatsare

RGBTriplets,whereeachcomponentisanintegerfrom0through255.Forexample,"255,0,0".RGBtripletsarewrappedindoublequotesexceptwhentheyareusedinqueryconditions,inwhichcasetheymustalwaysbewrappedinescapeddoublequotes('\"').See"ColorPatterns"below.

Page 101: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ColorBookColors,suchas"Pantone,123CVC",acompositeoftwocomma-separatednamesrepresentingaColorBookandacolorwithinit.Colorbookstringsarewrappedindoublequotesexceptwhentheyareusedinqueryconditions,inwhichcasetheymustalwaysbewrappedinescapeddoublequotes('\"').See"ColorPatterns"below.Andnomatterwheretheyareused,colorbookstringsmustalwaysbewrappedinescapeddoublequotesiftheycontaincertainspecialcharacters.Ifyouareunsureifacolorbookstringcontainsspecialcharacters,thereisnoharmwrappingitinescapeddoublequotesjusttobesure.

Expressions,suchas".COLOR"or".TRUECOLOR"(alwaysdouble-quoted).".COLOR"alwaysreturnsanACIcolor.Iftheselectedobject'scolorisatruecoloritreturnsthenearestACIequivalent.".TRUECOLOR"returnsatruecoloriftheselectedobject'scolorisatruecolor,oranACIifitscolorisanACI.Notethat".TRUECOLOR",andotherexpressionsthatcanreturntruecolors,returninvalidformatonlyifthetypeargumentof(ade_expreval)is"string".

ColorPatterns,comma-separatedlistsofcolorsinanyofthevalidformats,includingACIcolors,alwaysdouble-quoted.Colorpatternsareusedtoexpressmultiplecolorconditionsincompactformat.Considerthecolorpattern"red,green".Thepseudocodeexpression,color="red,green",islogicallyequivalentto(color="red")OR(color="green").Similarly,color<>"red,green"islogicallyequivalentto(color<>"red")AND(color<>"green").Becausecolorpatternsarecomma-separatedlists,ColorBookcolorsandRGBcolorsinqueryconditionsarealwaysboundedbyescapeddoublequotes('\"')becausetheyarethemselvescomma-separated.Forexample,thefollowingcolorpatternincludessixcolors:threeACIs,oneRGB,andoneColorBookcolor.

"12,34,56,\"12,34,56\",\"Pantone,123CVC\""

NoteYoucanusewildcardcharacterswhenyouspecifyamatchstringforColorBookcolors(butnotforRGBcolors).Forthisreason,anywildcardcharacterinaColorBookstringthatismeanttobetakenliterallymustbe

Page 102: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

escapedusingabackquote,"`".Forexample,the"."characterinthefollowingstring,normallyawildcardmatchinganynon-alphanumericcharacter,ismeantasaliteral:"My`.Colors,Hot".

Page 103: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PropertyAlterationDefinitionSamples

Thefollowingexamplescomposepropertyalterationdefinitionsthatuserangetables.

(defunc:run_altpsample1();RangetableforColoris:;<15"green";<20"yellow";otherwise"red"(ade_rtdefrange"COLOR_RANGE""ColorRangeTable"'(("<"15"green")("<"20"yellow")("otherwise""""red")));RangetableforTextValueis:;<15"Small";<20"Medium";otherwise"Large"(ade_rtdefrange"TEXT_RANGE""TextValueRangeTable"'(

Page 104: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

("<"15"Small")("<"20"Medium")("otherwise""""Large")));Thelayerofeachobjectwillbeusedtodeterminewhatvalue;fromtherangetableistobeused:;Clearoutanyexistingalterationdefinitions:(ade_altpclear);Nextdefinethecolorfortheobjectsbeingcreated:(ade_altpdefine"color""(range.layerCOLOR_RANGE)");Nextdefinethetextobjecttobecreatedforeachentity:(ade_altpdefine"textobject"'(("color""(range.layerCOLOR_RANGE)")("textvalue""(range.layerTEXT_RANGE)")));Forfill,usethefollowingpropertyalterationfunctions(ade_altpdefine"hatch"'(("pattern""(range.layerTEXT_RANGE)")("color""(range.layerCOLOR_RANGE)")))(princ))

Page 105: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(defunc:run_altpsample2();Rangetableforpatternis:(ade_rtdefrange"PATTERN_RANGE""HatchPatternRangeTable"'(("<"15"Earth")("<"20"Grass")("otherwise""""Swamp")));RangetableforColoris:(ade_rtdefrange"COLOR_RANGE""ColorRangeTable"'(("<"15"green")("<"20"yellow")("otherwise""""red")));Rangetableforscaleis:(ade_rtdefrange"SCALE_RANGE""HatchScaleRangeTable"'(("<"15"25")("<"20"50")("otherwise""""100")));RangetableforAngleis:(ade_rtdefrange"ANGLE_RANGE""HatchAngleRangeTable"'(("<"15"45")

Page 106: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

("<"20"90")("otherwise""""0")));Thelayerofeachobjectwillbeusedtodeterminewhichvalue;fromtherangetableistouse;Clearoutanyexistingalterationdefinitions:(ade_altpclear);Forfill,usethefollowingpropertyalterationfunctions(ade_altpdefine"hatch"'(("pattern""(range.layerPATTERN_RANGE)")("scale""(range.layerSCALE_RANGE)")("rotation""(range.layerANGLE_RANGE)")("color""(range.layerCOLOR_RANGE)")))(princ))

(defunc:run_altpsample3();Rangetableforsymbolnameis:(ade_rtdefrange"SYMBOL_RANGE""SymbolNameRangeTable"'(("<"15"Sym1")("<"20"Sym2")("otherwise""""Sym3")))

Page 107: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

;Rangetableforscaleis:(ade_rtdefrange"SCALE_RANGE""SymbolScaleRangeTable"'(("<"15"5")("<"20"10")("otherwise""""50")));RangetableforColoris:(ade_rtdefrange"COLOR_RANGE""ColorRangeTable"'(("<"15"green")("<"20"yellow")("otherwise""""red")));Thelayerofeachobjectwillbeusedtodeterminewhich;valuefromtherangetabletouse;Clearoutanyexistingalterationdefinitions:(ade_altpclear);Forfill,usethefollowingpropertyalterationfunctions:(ade_altpdefine"blockname""(range.layerSYMBOL_RANGE)")(ade_altpdefine"scale""(range.layerSCALE_RANGE)")(ade_altpdefine"color""(range.layerCOLOR_RANGE)")(princ))

Page 108: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

MoreSamples

TherearedozensofVisualLISPsamplesintheSamplefolderofyourAutoCADMapinstallation.

Page 109: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

UsingAutoLISPFunctions

TowriteAutoLISPprograms,usetheVisualLISPIDE.Youdonotneedacompiler,becauseAutoCADMapincludesaninterpreterthatprocessesAutoLISPsourcecodedirectly.

OptionalParameters

IfanAutoLISPfunctionhasoptionalparameters,theyareenclosedinsquarebracketsinthefunctionprototype.Ifaparameterisoptional,youcanomititsargumentifnoargumentsfollow.

A-lists

Theterma-listusedinAutoLISPfunctiondescriptionsdenotesanassociationlist,alsocalledadottedpair.Itlookslikethis:

(property.value)

Forexample,intheexpression

(ade_altpdefine"textobject"'(("color"."yellow")("textvalue".".Layer")))

thesub-expression("color"."yellow")isana-list,andsois("textvalue".

Page 110: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

".Layer").

InvokingDataExtensionCommands

YoucaninvokealmostanyDataExtensioncommandusingtheAutoLISPexpression,(command"_.ADE[XX]"...).TheexceptionsareADEDEFCRDSYS,ADEZEXTENTS,ADEEDITDATA,andADEATTACHDATA.YoucannotinvokethesecommandsfromwithinADSRXorVisualLISP.FortheADEKEYVIEWcommand,onlytheRedisplayoptionissupportedwhenADSRXorVisualLISPisactive.

IncompleteExecutionofFunctions

IfanAutoLISPfunctionthatperformsasequenceoftasksfailspartwaythroughitsexecutionandreturnsanerrorcode,thetasksitcompletedcorrectlyareundone.Forexample,ade_qrysetcondmodifiesaquerycondition.Ifyoucallthisfunctionanditisnotabletomodifyeverycomponentofthecondition,thecomponentsitdidmodifyarereturnedtotheiroriginalstates.

Page 111: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

NumericIdentifiers

AutoLISPfunctionsworkwithnumericidentifiers(IDs).Theirtypeisreal.

Forexample,whenyouuseade_dslisttolistthedrawingsattachedtothecurrentdrawing,thefunctionreturnsalistofIDs,notdrawingnames.Togetadrawingname,youcallade_dwggetsettingwithtwoarguments:"dwgname"(thesettingyouwanttoknowabout)andthedrawingID.

TopologyfunctiondocumentationusesanumberofdifferentkindsofIDs.SeeTopologyIDsforanannotatedlist.AlthoughtheseIDsareallthesametype,ade_id,wegivethemdifferentnamesinthedocumentationaccordingtotheirpurpose.

Page 112: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TypographicConventions

Thisdocumentationusesthefollowingtypographicconventions.

TypographicConventions

Textelement Description Example

boldsansserif Textyouenter Atthecommandprompt,enter(ade_dslist).

italic Namesoffilesanddirectories

c:\map\map_api.hlp

monospacefont APIpropernames,inlinesamplecode

Theexpression("color"."yellow")...

[]squarebrackets Optionalparametersinfunctionprototypes

(tpm_iterstart[source][loaded])

NoteAllfilenamesanddirectorypathsinAutoCADMaparecasesensitive.

Page 113: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanactionlistgetatCleanupFunctions

Getsthecleanupactionatagivenlistposition.

(tpm_cleanactionlistgetatclean_var_idindexaction_var_id)

Returnsacleanupactionasacleangrouptype(integer)or0onerror:seetpm_cleangrouptypeforalistoftypes.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

index Listpositiontoaccess(integer)

action_var_id CleanupactionvariablesID(real)returnedbytpm_varalloc

Theclean_var_idargumentreferencespropertiesforthecleanupoperationthatyouarepreparingtoinitiate(seeCleanupVariables).Thesepropertiesincludetheactionlist.

Theindexargumentisazero-basedpositionintheactionlist.Avaluegreaterthanorequaltothelistsizeorlessthan0returnsanerror.

Theaction_var_idargumentreferencespropertiesaffectingthespecificcleanupactionthatyouaregetting(seeCleanupActionVariables).Usetpm_vargetortpm_varlisttoreadthemaftercallingtpm_cleanactionlistgetat.

Page 114: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanactionlistinsCleanupFunctions

Insertsacleanupactionintheactionlist.

(tpm_cleanactionlistinsclean_var_idindexactionaction_var_id)

ReturnsTornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

index Wheretoinsertinthelist(integer)

action Cleanupactiontoinsert(integer),acleangrouptype:seetpm_cleangrouptypeforalistoftypes.

action_var_id CleanupactionvariablesID(real)returnedbytpm_varalloc

Theclean_var_idargumentreferencespropertiesforthecleanupoperationthatyouarepreparingtoinitiate(seeCleanupVariables).Thesepropertiesincludetheactionlist.

Theindexargumentisazero-basedpositionintheactionlist,or-1forthelastposition.Avaluegreaterthanorequaltothelistsizeorlessthan-1istakenas-1.

NoteWhenyouinserttheSimplifyObjectsaction(cleangrouptype128),itisalwayslistedfirst,andyoucannotinsertitmorethanonce.

Theaction_var_idargumentreferencespropertiesaffectingthespecific

Page 115: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

cleanupactionthatyouareinserting(seeCleanupActionVariables).Usetpm_varsettosetthembeforecallingtpm_cleanactionlistins.

ADSRXEquivalent

inttpm_cleanactionlistins

ade_idclean_var_id,longindex,intaction,ade_idaction_var_id);

ReturnsRTNORMoranerrorcode.

Page 116: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangrouptypeCleanupFunctions

Determinesthetypeofthecurrentgroup.

(tpm_cleangrouptypeclean_id)

Returnsatypecodeornil.

clean_id ModelIDreturnedbytpm_cleanalloc

TypeCodes

1 Eraseshortobjects

2 Breakcrossingobjects

4 Extendundershoots

8 Deleteduplicates

16 Snapclusterednodes

32 Dissolvepseudonodes

64 Erasedanglingobjects

128 Simplifyobjects

256 Zerolengthobjects

512 Apparentintersections

Page 117: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1024 Weedpolylines

Page 118: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleancreatedssCleanupFunctions

Getscreatedentitiesfollowingadrawingcleanup.

(tpm_cleancreatedssclean_id)

Returnsaselectionset.

clean_id CleanupmodelID(real),returnedbytpm_cleanalloc.

Thisfunctionreturnsentitiesthatwerecreatedduringthecleanupprocess.

NoteCallthisfunctionaftercallingtpm_cleanend,whichconcludesthecleanupprocess.Ifyoucallthisfunctionearlier,itreturnsaselectionsetfromthepreviouscleanuportheemptyselectionset.

Page 119: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanmodifiedssCleanupFunctions

Getschangedentitiesfollowingadrawingcleanup.

(tpm_cleanmodifiedssclean_id)

Returnsaselectionset.

clean_id CleanupmodelID(real),returnedbytpm_cleanalloc.

ThisfunctionreturnsmembersoftheIncludesetthatwerechangedduringthecleanupprocess.

NoteCallthisfunctionaftercallingtpm_cleanend,whichconcludesthecleanupprocess.Ifyoucallthisfunctionearlier,itreturnsaselectionsetfromthepreviouscleanuportheemptyselectionset.

Page 120: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanunchangedssCleanupFunctions

Getsunchangedentitiesfollowingadrawingcleanup.

(tpm_cleanunchangedssclean_id)

Returnsaselectionset.

clean_id CleanupmodelID(real),returnedbytpm_cleanalloc.

ThisfunctionreturnsmembersoftheIncludesetthatwerenotchangedduringthecleanupprocess.NotethatitdoesnotreturnmembersoftheAnchorset,whichareunchangedbydefinition.

NoteCallthisfunctionaftercallingtpm_cleanend,whichconcludesthecleanupprocess.Ifyoucallthisfunctionearlier,itreturnsaselectionsetfromthepreviouscleanuportheemptyselectionset.

Page 121: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracebestrouteNetworkTracingFunctions

Calculatesthebestround-triproute.

(tpm_tracebestroutetpm_idtrace_idnode0node1...noden)

ReturnsatopologyID(real)representingthebestrouteornil.

tpm_id TopologyID(real)representingthenetworkyouareanalyzing

trace_id TracingmodelID(real)returnedbytpm_tracealloc

node0 ElementID(real)ofthestartandendnode

node1...noden ElementIDs(real)ofthenodestovisit

Thebestroutetopology,whoseIDthisfunctionreturnsifsuccessful,isassignedanarbitrarynameandisopenforread.Togetitsname,usetpm_infoname.Tochangeitsname,usetpm_mntrename.

Forthebestroutetracetosucceed,thetotalcalculatedresistancecannotbegreaterthanthevaluesetforthemaximumresistanceorlessthanthevaluesetfortheminimumresistance.Seetpm_tracesetmaxresandtpm_tracesetminres.Theaccumulatedresistancevalueisthetotalresistanceofthenodesandlinksthatmakeupthebestroute.

Typicalusage:

Page 122: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqbestroute(tpm_tracebestroutetpm_idtrace_id7.01.04.010.05.06.09.0))

where7.0istheelementIDofthestartandendnodeandtheremainingargumentsareelementIDsofthenodestovisit.(ElementIDsarereturnedbytpm_traceelemid.)

ADSRXEquivalent

ade_idtpm_tracebestroute

ade_idtpm_id,ade_idtrace_id,structresbuf*nodes);

ReturnsatopologyIDorADE_NULLID.

Thelistofnodesisimplementedasaresbufchain,whichyoucancreatelikethis:

structresbuf*nodes;//nodeliststructresbufrb0,rb1,..,rbN;//resbufelementsade_idnode0,node1,..,nodeN;//nodestoanalyze//gettracingelementIDsforthenodes//thatwewillanalyzeandassignthemto//node0,node1,..,nodeN...rb0.restype=RTLONG;rb0.resval.rlong=node0;rb0.rbnext=&rb1;rb1.restype=RTLONG;

Page 123: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

rb1.resval.rlong=node1;rb1.rbnext=&rb2;...rbN.restype=RTLONG;rbN.resval.rlong=nodeN;rbN.rbnext=NULL;nodes=&rb0;

Page 124: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracebestroutescanNetworkTracingFunctions

GetstheelementIDofalinkornodeinthebestroute.

(tpm_tracebestroutescantrace_idflag)

ReturnsanelementID(real)ornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

flag Pathelementcode(integer):0=Currentelement1=Firstelement2=Lastelement3=Nextelement4=Previouselement

Firstusetpm_tracebestroutetocalculatethebestroute.

ADSRXEquivalent

ade_idtpm_tracebestroutescan

ade_idtrace_id,intflag);

ReturnsaelementIDorADE_NULLID.

Page 125: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracebestroutevalNetworkTracingFunctions

Calculatestheresistanceofthebestroute.

(tpm_tracebestroutevaltrace_id)

Returnsaresistancevalue(real)ornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

Firstusetpm_tracebestroutetocalculatethebestroute.

ADSRXEquivalent

inttpm_tracebestrouteval

ade_idtrace_id,ads_real*resist);

ReturnsRTNORMoranerrorcode.

resist Resistance

TheADSRXfunctionpassestheresistanceofthebestroutethroughaparameterinsteadofreturningitastheAutoLISPfunctiondoes.

Page 126: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ColorIndexColors

Validcolorindexvaluesareintegersfrom0through256.Youcanalsousecolornamesorthelogicalcolors,ByBlockandByLayer.

AutoCADMapalsosupportstruecolor.

NamedColors

Indexes1through7arethenamedcolors.Youcanspecifyanyofthesecolorsbynameorbyindex.Index7,thecolornamedwhite,displaysaswhiteorblackdependingonbackgroundcolor.

Index Name

1 Red

2 Yellow

3 Green

4 Cyan

5 Blue

6 Magenta

7 White

NoteYoucanspecifyACIcolorsinqueryconditionsusingcolornamesorcolorindexes.Butifyouretrievesuchacondition,ACIcolorsarealwaysreportedas

Page 127: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

colorindexes,becausethatishowtheyarestored,eveniftheywereoriginallyspecifiedwithcolornames.However,thisisnotthecasewithcolorpatterns.Ifyouretrieveaconditionusingacolorpattern,whetheritcontainscolorindexes,colornames,orboth,thecolorpatternisreportedasitwasoriginallyspecified.

OtherColors

Indexes8and9(adarkgrayandalightgray),togetherwiththenamedcolors,arecollectivelythestandardcolors.Indexes0and256(thelogicalcolors,ByBlockandByLayer)invoketherelevantblockandlayercolorsrespectively.NotethatByBlockandByLayercanreturnACIsortruecolors.

Formoreinformation1. InAutoCADMap,clickFormat>Color.2. IntheSelectColordialogbox,clickHelp.

Page 128: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_prefgetvalOptionFunctions

GetsanAutoCADMapoptionsetting.

(ade_prefgetvalvariable)

Returnsanoptionsettingornil.

variable Optionname(string).SeetheOptionstablesbelow.

Thefunctionreturnvaluedependsonwhichoptionyouspecify.Thetablesbelowshowoptionnamesandreturnvalues,organizedbyoptiontype.

WorkSessionOptions

RestoreLastActiveDwgsOnStartup Tornil.

ActivateDwgsOnAttach Tornil.

DontAddObjectsToSaveSet Tornil.

MarkObjectsForEditingWithoutPrompting Tornil.

LogFileActive Tornil.

LogFileName Filename(string).Forexample,"ade.log".

LogMessageLevel 0,1,or2.

Page 129: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

QueryOptions

QueryFileDirectory. Path(string).Forexample,"c:\\data\\qry".

CaseSensitiveMatch. Tornil.

SaveCurrQueryInSession. Tornil.

MkSelSetWithQryObj Tornil.

DefaultJoinOperator 1=OR,2=AND.

ColorForAdd Color(string).

ColorForRemove Color(string).

BlockLocnForQuery 1=insertionpoint,2=boundingbox.

TextLocnForQuery 1=insertionpoint,2=boundingbox.

ShowBlockAsInsPt Tornil.

ShowImageAsBoundary Tornil.

CreateAssociativeHatchObjects Tornil.

ReferenceBoundaryForAreaLocation Tornil.

SaveBackOptions

RedefineBlockDefinitions Tornil.

RedefineLayerDefinitions Tornil.

RedefineTextStyleDefinitions Tornil.

RemoveUnusedGroups Tornil.

Page 130: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

EraseSavedBackObjects Tornil.

RemoveLockAfterSave Tornil.

CreateHistoryFileOfChanges Tornil.

CreateBackupFileOfSourceDwg Tornil.

ExternalDatabaseOptions

NoOfSQLConditionsInHistory integer.

DisplayTabsInSingleView Tornil.

OpenDataViewReadOnly Tornil.

SaveDataViewFmtChanges Tornil.

ReconnectDbOnWSOpen Tornil.

ShowFullDBPath Tornil.

KeepDataViewOnTop Tornil.

dbfDatabases string,oneofthefollowing:"Prompt","DB3","DB4","DB5","FOX2.0","FOX2.5",or"FOX2.6".

xlsDatabases string,oneofthefollowing:"Prompt","Excel3","Excel4","Excel5",or"Excel7".

dbDatabases string,oneofthefollowing:"Prompt","Paradox3.0","Paradox4.0",or"Paradox5.0".

CoordinateTransformationOptions

Page 131: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CoordinateTransformationOptions

AdjustSizesAndScalesForChangesInUnits Tornil.

AdjustRotationsForMapDistortions Tornil.

AdjustSizesAndScalesForMapDistortions Tornil.

AdjustElevations Tornil.

AdjustZeroRotationObjects Tornil.

.

SystemOptions

AccessWorkCenter Tornil.

CheckoutDirectory Path(string).Forexample,"c:\\data\\dwg"or""ifnone.

PreserveAWCFiles Tornil.

ForceUserLogin Tornil.

EnableObjectLocking Tornil.

ReadPrefFromINI Tornil.

NumberofOpenDwgs integer

DoublePrec real,0orgreater,butlessthan1.

The"ForceUserLogin"and"DoublePrec"systemoptionscannotbemodifiedunlessyourenduserhassuperuserprivileges.

If"DoublePrec"issetto0,thebehaviorofdataextensionqueriesisthesameasbeforeintroducingthisoption.The"DoublePrec"optionhasnouserinterfaceequivalent.

Page 132: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

WorkspaceOptions

CheckClasses Tornil.

CheckDrawings Tornil.

CheckQueryLibrary Tornil.

CheckDatabases Tornil.

CheckTables Tornil.

CheckQueries Tornil.

CheckTopologies Tornil.

CheckLPNs Tornil.Notethatlinkpathnames(LPNs)havebeenreplacedbylinktemplatesinAutoCADMap.

ShowOPMOnStartup Tornil.

ShowWSpaceOnStartup Tornil.

WSpaceDockingView Tornil.

WSpaceWindowRect Alistoffourvalues(integer)thatdefinetheleft,top,right,andbottomofthewindowrectangle.

Databasetablesanddatabasequerycategoriesarevisibleintheworkspaceonlyif"CheckTables"and"CheckQueries"aresettoTand"CheckDatabases"issettoTalso.

Thefollowingworkspaceoptionsarereadonly.Thatis,theycanbeusedonlywithade_prefgetvaltodetermineifacategoryisvisibleintheworkspace.

Read-OnlyWorkspaceOptions

Page 133: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ClassesVisible Tornil.

DrawingsVisible Tornil.

QueryLibraryVisible Tornil.

DatabasesVisible Tornil.

TablesVisible Tornil.

QueriesVisible Tornil.

TopologiesVisible Tornil.

LPNsVisible Tornil.

Page 134: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_prefsetvalOptionFunctions

SetsanAutoCADMapoption.

(ade_prefsetvalvariablevalue)

ReturnsTornil.

variable Optionname(string)

value Valueappropriateforthegivenoption(typevaries).

Seeade_prefgetvalforalistofoptionnamesandvalues.

Thefollowingexamplesets"ColorForAdd"to"red".

(ade_prefsetval"ColorForAdd""red")

Page 135: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altpdefinePropertyAlterationFunctions

Createsapropertyalterationexpression.

(ade_altpdefinepropertyvalue)

ReturnsapropertyalterationexpressionIDornil.

property Propertytoalter(string).SeetheAlterablePropertiestablebelow

value Newvalue(typevaries),orarangetableexpression(string)thatdeterminesthenewvalue.SeeUsingaRangeTablelaterinthistopic.

Alistofoneormorepropertyalterationexpressionsconstitutesapropertyalterationdefinition.Ifthereisacurrentpropertyalterationdefinitionwhenyoucreateapropertyalterationexpression,thenewexpressionisaddedtoit.WhenyouexecuteaDrawquery,eachqueriedentityisalteredinaccordwiththecurrentpropertyalterationdefinition.

Thefollowingtableliststhealterableproperties:

AlterableProperties

blockname Blockname(string)

color Color(string)

elevation Zcoordinate(point)intheusercoordinatesystem

Page 136: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

height Textheight(real)

layer Layername(string)

linetype Linetype(string)

rotation Rotation(real)

scale Scalingfactor(real).Forexample,1.2=120%

style Textstyle(string)

width Linewidth(real)

textvalue Textvalue(string)

thickness Thickness(real)

hatch Listofdottedpairsthatdefinethehatchproperties.SeeHatchpropertiesbelow

textobject Listofdottedpairsthatdefinethetextobjectproperties.SeeTextobjectpropertiesbelow

Toaddahatchpatterntoeachqueriedentity,aslongasitisaclosedpolygon,specify"hatch"forthepropertyargument.Thevalueargumentisthenalistofdottedpairs.Eachdottedpairiscomposedofahatchpropertyandastringvalue.

HatchProperties

pattern Hatchpatternname(string)

scale Scalingfactor(string).Forexample,"1.2"=120%

rotation Rotationofthehatchpattern(string)

layer Nameofthelayerthatcontainsthehatchpattern(string)

Page 137: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

color Hatchpatterncolor(string)

Tocreateatextobjectforeachqueriedentity,specify"textobject"forthepropertyargument.Thevalueargumentisthenalistofdottedpairs.Eachdottedpairiscomposedofatextobjectpropertyandastringvalue.Thevalueelementinthedottedpaircanbeanexplicitvalueorarangetableexpressionthatdeterminesavalue.

TextObjectProperties

textvalue Texttodisplay(string)

height Textheight(string)

inspt Pointwheretextisinserted(expressionasastring)

justify Textalignment(string).Forexample,"center".

style Textstyle(string)

layer Nameofthelayeronwhichthetextobjectresides(string)

color Textcolor(string)

rotation Rotationofthetextobject(string)

Thepropertyalterationexpressiondefinedby

(ade_altpdefine"color""red")

changesthecolorofeachqueriedentitytored.

Thepropertyalterationexpressiondefinedby

(ade_altpdefine"textobject"'(("color"."yellow")("textvalue".".Layer")))

Page 138: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

createsatextobjectforeachqueriedentity.Eachtextobjectisyellow,anditstextvalueisthelayeronwhichtheentityresides.

Alongerpropertyalterationexpressionforatextobject:

(ade_altpdefine"textobject"(list(cons"Textvalue"".Layer")(cons"Justify""MIDDLE")(cons"Inspt"".CENTER")(cons"Style""STANDARD")(cons"Height""1.0")(cons"Rotation""0.0")(cons"Color""BYLAYER")))

Apropertyalterationexpressionforahatch:

(ade_altpdefine"hatch"(list(cons"Pattern""USER")(cons"Scale""1.0")(cons"Rotation""45.0")(cons"Layer""Query_Hatch")(cons"Color""BYLAYER")))

UsingaRangeTable

Insteadofsupplyinganexplicitvalueargumentwhenyoucallade_altpdefine,youcansupplyarangetableexpressionthatreferencesanexistingrangetable.Notethatthisexpressionisastringvalue.Itmustbeenclosedinquotes.

Page 139: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Arangetableexpressionhasthefollowingformat:

(rangereferencertname)

RangeTableExpressionParameters

range Therangekeyword.Allrangetableexpressionsbeginwithrange.Itisnotquoted.

reference Referenceproperty,suchas.Coloror.Layer.Itisnotquoted.

rtname Rangetablename.Canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.Itisnotquoted.

Therangetableexpressionusesitsincludedrangetabletoprocessthevalueofthereferencepropertyandreturnanewpropertyvalue.Forexample,thefollowingcode(1)usesade_rtdefrangetodefinearangetable,(2)referencestherangetableinarangetableexpression,andthen(3)suppliestherangetableexpressionasthevalueargumentinanade_altpdefinecall.

Firstwedefinearangetable:

(ade_rtdefrange"rt_def""Changeallexceptredtoyellow"'(("="11)("OTHERWISE"""2)))

Thenwereferencethisrangetableinarangetableexpression,whichassertsthattherangetablewilllookatthe.Colorpropertyofeachqueriedentitytodetermineiftheentity'scolorwillbealteredandwhatcoloritwillbe.

(setqpropVal"(range.Colorrt_def)")

Page 140: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Finally,weusetherangetableexpressioninsteadofanexplicitpropertyalterationvalueinacalltoade_altpdefine.

(ade_altpdefine"color"propVal)

ThenexttimeaDrawqueryisexecutedwithPropertyAlterationineffect,thecolorofeachqueriedentityisaltereddependingonitscurrentcolorandinaccordancewiththerulesembeddedintherangetableanditsenclosingrangetableexpression.

Thefollowingexampleusesrealvalues:

(ade_rtdefrange"rt_def""Setrotation"'(("="45.90.)("OTHERWISE"""45.)))

Foranotherexample,youcouldrewritethe"textobject"examplecitedearliertousearangetable.

(adertdefrange"labelWaterOnly"""'(("=""Water""Water")("OTHERWISE""""")))(ade_altpdefine"textobject"'(("color"."yellow")("textvalue"."(range.LayermyRangeTable)")))

Thefollowingexampleexecutesalocationquerybasedonacircledefinedbytheuser.Itincludespropertyalterationbasedonarangetable.Thecolorofeachqueriedentity,ifitisnotalreadyred,ischangedtoyellow.

(ade_qryclear)(ade_qrysettype"draw")(ade_dwgzoomextents)

Page 141: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(prompt"\nQueryLOCATIONbyCIRCLE:")(setqc_cen(getpoint"\nCenterofcircle:")c_radp(getpointc_cen"\nRadiusofcircle:")c_rad(distancec_cenc_radp)qry_cond(list"circle""inside"c_cenc_rad)qry_id(ade_qrydefine"""""""location"qry_cond""))(if(nullqry_id)(prompt"\nERROR:Querydefinitionfailed.")(progn(ade_altpclear);Definetherangetable(ade_rtdefrange"rt_def""Changeallexceptredtoyellow"'(("="11)("OTHERWISE"""2)));Referencetherangetableinarangetable;expression;notethatit'sallonestring(setqpropVal"(range.Colorrt_def)"(if(or(null(ade_altpdefine"color"propVal))(null(ade_qrysetaltpropT)))(prompt"\nERROR:Alterpropertiesdefinitionfailed.")(if(=0.0(ade_qryexecute))(prompt"\nERROR:Noobjectsfound."));if);if);progn);if

Page 142: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altpgetpropPropertyAlterationFunctions

Getsapropertyalterationexpression.

(ade_altpgetpropaltp_id)

ReturnsapropertyalterationexpressionIDornil.

altp_id PropertyalterationexpressionID(real)

Seeade_altpdefineforinformationaboutpropertyalterationexpressions.

Page 143: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altpsetpropPropertyAlterationFunctions

Modifiesapropertyalterationexpression.

(ade_altpsetpropaltp_idpropertyvalue)

ReturnsTornil.

altp_id PropertyalterationexpressionID(real)

property Propertytoalter(string)

value Newvalue(typevaries).

Seeade_altpdefineforinformationaboutpropertiesandvalues.

Page 144: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrydefineQueryFunctions

Definesaquery.

(ade_qrydefinejoinopbggroupsnot_opcondtypeqrycondendgroups)

ReturnsaconditionIDornil.

joinop Ajoiningoperator:"and"or"or"or""(none).If""(none)isspecified,thedefaultjoiningoperatorisused(seeade_prefgetval).

bggroups Forgroupingthisconditionwithothersinthequerydefinitionyouarebuilding.Useoneormoreopenparenthesesasneeded,or""(none).Forexample,"((".

not_op TheNOToperator,ifneeded:"not"or""(none).

condtype Aconditiontype:"Location","Property","Data",or"SQL".

qrycond Aconditionexpression.Dependsontheconditiontype.SeeConditionExpressionsbelow.

endgroups Forgroupingthisconditionwithothersinthequerydefinitionyouarebuilding.Useoneormorecloseparenthesesasneeded,or""(none).Forexample,"))".

Aquerydefinitioniscomposedofoneormoreconditions,eachdefinedbyaseparateade_qrydefinecall.Youcangroupconditionsbysupplying

Page 145: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

parenthesesoremptystringstothebggroupsorendgroupsparametersasneeded.

Youmustspecifyallsixade_qrydefinearguments.

ConditionExpressions

Theqrycondparameterrequiresaconditionexpression.Conditionexpressionsarelists.Whatyouincludeinthelistdependsontheconditiontype:Location,Property,Data,orSQL.

LocationExpressionsPropertyExpressionsDataExpressionsSQLExpressions

Page 146: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrygetcondQueryFunctions

Getsaconditionofthecurrentquery.

(ade_qrygetcondcondition_id)

Returnsaqueryconditionornil.

condition_id QueryconditionID(real)

Seeade_qrydefineforinformationaboutqueryconditions.

Page 147: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrysetcondQueryFunctions

Replacesaquerycondition.

(ade_qrysetcondcondition_idcondition)

ReturnsTornil.

condition_id QueryconditionID(real)toreplace.

condition Newquerycondition(alist).Seeade_qrydefine.

Thisfunctionaffectsthecurrentquery.

Youcannotaltergroupingwiththisfunction.Anygroupingyouspecifyisignored.Togrouporungroup,useade_qrygrouporade_qryungroup.

Page 148: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PropertyExpressions

Propertyexpressionsareusedasquerycondargumentsinade_querydefinecallsthatdefinePropertyconditions.

Theyhavethefollowingformat:

(propertyoperatorvalue[subclasses])

PropertyExpressionParameters

property Propertyname(string).SeethePropertyandValueArgumentstablebelow.

operator "=",">","<","<=",">=","<>".Notethattheonlyvalidoperatorinastringcontextis"=".

value Dependsonthepropertyargument.SeethePropertyandValueArgumentstablebelow.

subclasses Optional.Tornil.Thedefaultiftheargumentisomittedisnil.Thissettinghasnoeffectunlesspropertyis"feature".Tmeansreturnallobjectsbelongingtothefeatureclassidentifiedbythevalueargument,includingobjectsbelongingtoanysubclassofthatfeature.nilmeansdonotincludeobjectsbelongingtosuchasubclass.

PropertyandValueArguments

Page 149: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Property Value

area Areavalue(string).

blockname Blockname(string).

color Color(string).

elevation Zcoordinate(string).

"feature" Featurename(string).

group Groupname(string).

layer Layername(string).

length Length(string).

linetype Linetype(string).

"lineweight" Lineweight(string).

"plotstyle" Plotstyle(string).

style Textstyle(string).

thickness Thickness(string).

objtype Objecttype(string),or"unknown".

value Textvalue(string).

PropertyExpressionExamples

ThefollowingexamplesdefinePropertyconditions.Thefirstspecifiesalayer:

(setqqry_id(ade_qrydefine'("and""""""property"("layer""=""WATER")"")

Page 150: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

))

Andthesecondspecifiesacolor:

(setqqry_id(ade_qrydefine'("or""(""not""property"("color""=""RED")"")))

Page 151: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DataExpressions

Dataexpressionsareusedasquerycondargumentsinade_querydefinecallsthatdefineDataconditions.

Theyhavethefollowingformat.

(datatypetablename.fieldnameoperatorvalue[subclasses])

DataExpressionParameters

datatype Datatypetomatch(string):"objdata","attrib","aselink","EED",or"feature".

tablename Dependsonthedatatypeargument.SeetheTablenameAndFieldnameArgumentstablebelow.

fieldname Dependsonthedatatypeargument.SeetheTablenameAndFieldnameArgumentstablebelow.

operator Comparisonoperator(string):"=",">","<","<=",">=",or"<>".Notethattheonlyvalidoperatorinastringcontextis"=".

value Valuetomatch.

subclasses Optional.Tornil.ThedefaultiftheargumentisomittedisT.Thissettinghasnoeffectunlessdatatypeis"feature".Tmeansreturnobjectsbelongingtothefeatureclass

Page 152: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

identifiedbythetablenameargument,includingobjectsbelongingtoanysubclassofthatfeature.nilmeansdonotincludeobjectsbelongingtosuchasubclass.

Thetablenameandfieldnameargumentsdependonthedatatypeargument:

TablenameandFieldnameArguments

datatype tablename fieldname

objdata Tablename. Fieldname.

attrib Blockname. Attributedefinition.

aselink Linktemplate. Columnname.

EED RegAppname. EEDfieldname.

feature FeatureClassname. Propertyname.

DataExpressionExamples

ThefollowingexamplesdefineDataconditionsofvarioustypes.

(ade_qrydefine'("""""""Data"("attrib""*.Type""=""c*")""))

(ade_qrydefine'("""""""Data"("objdata""mytable.fl1""=""1")""))

(ade_qrydefine'("""""""Data"("aselink""cpu_lpn.cpu""=""MAC2LC")""))

Page 153: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_qrydefine'("""""""Data"("EED""REGAPP.STREET""=""Willow")""))

(ade_qrydefine'("""""""Data"("EED""REGAPP.#NUMBER""=""512")""))

(ade_qrydefine'("""""""Data"("EED""REGAPP.&SQLLINK;""=""MAC2LC")""))

Noteinthelastexamplethat&SQLLINKisnottreatedasalinktemplatekey.ItistreatedjustlikeanyotherADE1.0EEDfield.Forexample,ifanobjecthasEEDsuchas

(-3(1000."&EEDFIELD;"="1234"))

thentheDataconditiontoretrievetheobjectiswrittenasfollows:

("EED""REGAPP.&EEDFIELD;""=""1234")

IftheEEDisdefinedby

(-3(1000."&EEDFIELD;"="'First','Last'"))

thentheDataconditiontoretrievetheobjectiswrittenasfollows:

("EED""REGAPP.&EEDFIELD;""=""'First','Last'")

Page 154: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Inotherwords,everthingaftertheequalsignistreatedasonestring.Thatwayyoucanuseanypattern(forwcmatch)inthequery.

Page 155: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_aliasaddDriveAliasFunctions

Createsadrivealias.

(ade_aliasaddalias_namepath_name)

ReturnsTornil.

alias_name Aliasname(string).Canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

path_name Driveandpathtowhichthealiasrefers(string).

Thefunctionaddsanewdrivealiastothedrivealiaslist.Forexample:

(ade_aliasadd"tutor""c:\\tutorials\\drawings")

Page 156: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_aliasdeleteDriveAliasFunctions

Deletesadrivealias.

(ade_aliasdeletealias_name)

ReturnsTornil.

alias_name Aliasname(string);canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

Page 157: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_aliasgetlistDriveAliasFunctions

Listsalldrivealiasesintheproject.

(ade_aliasgetlist)

Returnsthelistofdrivealiasesornil

Thelistofdrivealiasesisalistofa-lists.Eacha-listdisplaysthealiasnameandthedriveandpathtowhichitrefers.

Page 158: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_aliasupdateDriveAliasFunctions

Changestheactualpathofadrivealias.

(ade_aliasupdatealias_namepath_name)

ReturnsTornil.

alias_name Aliasname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

path_name Newactualpathforthisdrivealias(string).

Page 159: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altpclearPropertyAlterationFunctions

Clearsthecurrentpropertyalterationdefinition.

(ade_altpclear)

ReturnsTornil.

Apropertyalterationdefinitionisalistofoneormorepropertyalterationexpressions.Seeade_altpdefineforinformationaboutpropertyalterationexpressions.

Page 160: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altpdelpropPropertyAlterationFunctions

Deletesapropertyalterationexpression.

(ade_altpdelpropaltp_id)

ReturnsTornil.

altp_id PropertyalterationexpressionID(real)

Page 161: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_altplistPropertyAlterationFunctions

ListstheIDsofthecurrentpropertyalterationexpressions.

(ade_altplist)

ReturnsalistofpropertyalterationIDsornil.

Thislistofpropertyalterationexpressionsreturnedbythisfunctionconstitutesthecurrentpropertyalterationdefinition.

Page 162: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dsattachDrawingSetFunctions

Attachesadrawingtotheprojectdrawing.

(ade_dsattachdwgname)

ReturnstheIDoftheattacheddrawingornil.

dwgname Pathaliasandfilename(string)

ThisfunctionreturnsanIDevenifthedrawingdoesnotexist.Asystemadministratorcanusethisfunctiontodefineadrawingsetbeforethedrawingfilesitreferencesarecreatedorinstalled.Adrawingmustexistbeforeyoucanmakeitactive.

(ade_aliasadd"dwg_drive""d:\\myproject\\mydir")(setqdwg_id(ade_dsattach"dwg_drive:\\mydrawing.dwg"));checkifdrawingwassuccessfullyattached(ifdwg_id;checkifitreturnedanID(princ"\nSuccessfullyattached.")(princ"\nDidnotattach."))

Page 163: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dsdetachDrawingSetFunctions

Detachesadrawingfromtheproject.

(ade_dsdetachdwg_id)

ReturnsTornil.

dwg_id DrawingIDtodetach(real)

Thefollowingcodedetachesthedrawingattachedintheade_dsattachexample:

(if(ade_dsdetachdwg_id);checkifitreturnedT(princ"\nSuccessfullydetached.")(princ"\nDidnotdetach."))

Page 164: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dsisnestedDrawingSetFunctions

Checksifadrawinghasnesteddrawings.

(ade_dsisnested[dwg_id])

ReturnsTifthedrawinghasdrawingsattached,ornil.

dwg_id DrawingID(real)

Verifythatthedrawinginquestionisactivebeforecallingade_dsisnested.Itisnotpossibletodetermineifaninactivedrawinghasnesteddrawings.Ifdwg_idisnotspecifiedorisnil,thefunctioncheckstheprojectdrawingtoseeifithasdrawingsattached.

;GetIDsofdrawingscurrentlyattached(setqds_ids(ade_dslist));Seeifthefirstonehasnesteddrawings(princ"\nFirstdrawinghas"(if(ade_dsisnested(cards_ids))(princ"drawingsattached.")(princ"nodrawingsattached."))

Page 165: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dslistDrawingSetFunctions

Liststhedrawingsattachedtoagivendrawing.

(ade_dslist[dwg_id[nested]])

ReturnsalistofdrawingIDsornil.

dwg_id DrawingID(real)ornil

nested Drawingisnestedornot.Values:Tornil

Ifthedwg_idargumentisomittedornil,thefunctionreturnsdrawingIDsforthedrawingsattachedtotheproject.

Ifyousupplyanestedargumentotherthannil,thefunctionincludesdrawingsthataredirectlyattachedandallnesteddrawingsateverylevelbelowthem.Otherwise,itincludesonlydrawingsthataredirectlyattached.

(setqds_ids(ade_dslist))

Page 166: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dsproplistDrawingSetFunctions

Listsallvaluesfoundinthedrawingsetforagivendrawingproperty.

(ade_dsproplistproperty)

Returnsalistofvaluesornil.

property Drawingproperty(string).SeeDrawingPropertiesbelow.

Thefunctionsearchesallactivesourcedrawingsandreturnsalistofthevaluesitfindsforthegivendrawingproperty.

Thefollowingtableshowspropertynamesandreturnvalues.

DrawingProperties

object_type AutoCADobjecttypes(string)

blockname Blocknames(string)

linetype Linetypenames(string)

textstyle Textstylenames(string)

attrib Attributenametags(string)

extents Computedextents:thelower-leftandupper-rightpointsinthesetofactivesourcedrawings.Forexample:((2.202864.99866)(20.468912.3563))

Page 167: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

group Groupnames(string)

layer Layernames(string)

lpn Linktemplates(string).Notethatlinkpathnames(LPNs)havebeenreplacedbylinktemplatesinAutoCADMap.

objdata Namesofobjectdatatables.Tablenamescanbeupto25characterslong(string).Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

mlinestyle Mlinestyle(string)

feature Featurename(string)

lineweight Lineweight(string)

plotstyle Plotstyle(string)

Thiscodereturnsalistoflayersinthedrawingset.

(ade_dsproplist"layer")

Page 168: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgactivateDrawingFunctions

Activatesadrawing.

(ade_dwgactivatedwg_id)

ReturnsT,ifthedrawingisalreadyactive,ornil.

dwg_id DrawingID(real)

Youcanattachadrawingthatdoesnotyetexist,butyoucannotactivateit.Seeade_dsattach.

Page 169: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgactualpathDrawingFunctions

Returnstheactualpathforadrawing.

(ade_dwgactualpathdwg_id)

Returnsthefullpath(withoutanalias)ofthespecifieddrawingornil.

dwg_id DrawingID(real)

Page 170: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgaliaspathDrawingFunctions

Returnsthealiaspathforadrawing.

(ade_dwgaliaspathdwg_path)

Returnsthealiaspathofthespecifieddrawingornil.

dwg_path Actualpathofthedrawing(string)

Page 171: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgattriblistDrawingFunctions

Returnsalistofattributetagsforthespecifiedblockname.

(ade_dwgattriblistdwg_idblock_name)

Returnsalistofattributetagsornil.

dwg_id DrawingID(real)

block_name Blocknameforwhichtogetattributetags(real)

Thisfunctionreturnsalistoftheattributetags,givenablocknamefromthespecifieddrawing.

Page 172: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgdeactivateDrawingFunctions

Deactivatesadrawing.

(ade_dwgdeactivatedwg_id)

ReturnsTornil.

dwg_id DrawingID(real)

Thiscodedeactivatesallthedrawingsinthedrawingset:

(foreachdwg_id(ade_dslist)(ade_dwgdeactivatedwg_id))

Thiscodeusesthemapcarfunctiontodeactivatethedrawingsinthedrawingset.

(mapcar'ade_dwgdeactivate(ade_dslist))

Page 173: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwggetidDrawingFunctions

GetsthedrawingIDofadrawing.

(ade_dwggetiddwg_pathname)

ReturnsadrawingID(real)ornil.

dwg_pathname Pathaliasanddrawingfilename(string)

Codeexample:

(ade_aliasadd"mydwgs""d:\\myproject\\mydrawing")(setqdwg_id(ade_dwggetid"mydwgs:\\mydrawing.dwg"))

Page 174: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwggetsettingDrawingFunctions

Getsadrawingsettingvalue.

(ade_dwggetsettingdwg_idsetting)

Returnsthevalueofthegivendrawingsettingornil.

dwg_id DrawingID(real)

setting Drawingsettingname(string).SeeDrawingSettingNamesbelow

DrawingSettingNames

SettingName ReturnValue

dwgname Drawingname(string);apathaliasandfilename,suchas"myfiles:\\mydwg.dwg”

dwgdesc Drawingdescription(string)

t_scale Simpletransformscale(real.Forexample,1.2=120%

t_rotate Simpletransformrotationdirection.ValuedependsontheAutoCADANGDIRsetting(real).Values:0=counterclockwise1=clockwise

Page 175: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

t_xoffset SimpletransformXoffset(real)

t_yoffset SimpletransformYoffset(real)

t_apply Flagvalue(integer).Values:1=applyallsimpletransformationsdefinedforthegivendrawing0=donotapplytransformations

saveback Savebackcoordinates,asequenceofcornerpoints,inthisorder:lowerleft,lowerright,upperright,upperleft,separatedby"."

Thefollowingcodegetsthenameofthefirstdrawinginthelistofattacheddrawings:

(setqdwg_id(car(ade_dslist)))(ade_dwggetsettingdwg_id"dwgname")

Thereturnvalueisadrawingpathname,forexample,

"c:\\drawings\\mydwg.dwg"

Page 176: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwghaslocksDrawingFunctions

Checksifadrawinghaslockedobjects.

(ade_dwghaslocksdwg_id)

ReturnsTifthedrawinghaslockedobjects,ornil.

dwg_id DrawingID(real)

Page 177: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgindexDrawingFunctions

Createsorremovesindexesforagivensetofdrawings.

(ade_dwgindexdwgIds)

ReturnsTornil.

dwgID ListofdrawingIDsforwhichindexeswillbecreated.

Callstoade_dwgindexdefaddindexoperationstotheindexoperationlist.Callingade_dwgindexexecutestheindexoperationsinthelist.Iftheindexoperationlistisempty,ade_dwgindexhasnoeffectandreturnsnil.

Thefollowingexamplecreateslocationandpropertyindexesforeachattacheddrawing:

;cleartheindexoperationslist(ade_dwgindexdefnil)

;adda'createlocationindex'operationtothelist(ade_dwgindexdef"location"1)

;adda'createpropertyindex'operationtothelist(ade_dwgindexdef"property"1)

;executethegivenindexoperationsforeachattacheddrawing(mapcar'ade_dwgindex(ade_dslist))

Page 178: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4
Page 179: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgindexdefDrawingFunctions

Addsoperationstotheindexoperationslist.

(ade_dwgindexdefindextype[indexoper][indexparams])

ReturnsTornil.

indextype Typeofindex(string):"location","property","eed","sqllinks","objdata",ornil,wherenilmeansremoveall.

indexoper Operation(integer):1=create,0=remove.Omitthisargumentifindextypeisnil.

indexparams Listofobject-datatablesandfieldstoincludeintheindexifindextypeis"objdata",orniltoincludeall.Addthisargumentonlyifindextypeis"objdata".

Callstoade_dwgindexdefaddoperationstotheindexoperationslist.Callingade_dwgindexexecutestheindexoperationsinthelist.Iftheindexoperationlistisempty,ade_dwgindexhasnoeffectandreturnsnil.

Examples

(ade_dwgindexdefnil)Removeallindexes.

(ade_dwgindexdef"location"1)Createalocationindex.

Page 180: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_dwgindexdef"location"0)Removethelocationindex.

(ade_dwgindexdef"property"1)Createapropertyindex.

(ade_dwgindexdef"property"0)Removethepropertyindex.

ObjectDataExamples

(ade_dwgindexdef"objdata"1nil)Createanobjectdataindexthatincludesallobjectdata.

(ade_dwgindexdef"objdata"0nil)Removeallobjectdatafromtheobjectdataindex.

(ade_dwgindexdef"objdata"1'(("TABLE")))CreateanobjectdataindexthatincludesallfieldsinTABLE.

(ade_dwgindexdef"objdata"0'(("TABLE")))RemoveallfieldsinTABLEfromtheobjectdataindex.

MoreObjectDataExamples

(ade_dwgindexdef"objdata"1'(("TABLE""FIELD1")))

(ade_dwgindexdef"objdata"0'(("TABLE""FIELD1")))

(ade_dwgindexdef"objdata"1'(("TABLE""FIELD1""FIELD2")))

(ade_dwgindexdef"objdata"0'(("TABLE""FIELD1""FIELD2")))

(ade_dwgindexdef"objdata"1'(("TABLE1")("TABLE2""FIELD1")))

(ade_dwgindexdef"objdata"0'(("TABLE1")("TABLE2""FIELD1")))

Page 181: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgisactiveDrawingFunctions

Checksifadrawingisactive.

(ade_dwgisactivedwg_id)

ReturnsTornil.

dwg_id DrawingID(real)

ThefunctionreturnsTifthespecifieddrawingisactive.IfthedrawingisnotactiveorthedrawingIDisinvalid,thefunctionreturnsnil.

Page 182: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgistoplevelDrawingFunctions

Checksifadrawingisdirectlyattachedtotheprojectdrawing.

(ade_dwgistopleveldwg_id)

ReturnsTifthedrawingisattacheddirectlytotheprojectdrawing,ornil.

dwg_id DrawingID(real)

Page 183: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgproplistDrawingFunctions

Listsallvaluesfoundinadrawingforagivendrawingproperty.

(ade_dwgproplistdwg_idproperty)

Returnsalistofthevaluesforthedrawingproperty,ornil.

dwg_id DrawingID(real)

property Propertyname(string).SeePropertyNamesbelow

Thefunctionsearchesthegivendrawingandreturnsalistofthevaluesitfindsforthegivendrawingproperty.

PropertyNames

Name ReturnValue

object_type AutoCADobjecttypes(string)

blockname Blocknames(string)

linetype Linetypenames(string)

textstyle Textstylenames(string)

attrib Attributetagnames(string)

extents Computedextents.Themostlower-leftpointandthemost

Page 184: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

upper-rightpointinthedrawingForexample:((2.202864.99866)(20.468912.3563))

group Groupnames(string)

layer Layernames(string)

lpn Linktemplates(string).Notethatlinkpathnames(LPNs)havebeenreplacedbylinktemplatesinAutoCADMap

objdata Namesofobjectdatatables(string)

mlinestyle Mlinestyle(string)

feature Featurename(string)

lineweight Lineweight(string)

plotstyle Plotstyle(string)

Thefollowingcodeidentifiesthelastdrawingattachedtotheprojectdrawingandreturnsalistofitslayers.

(setqdwg_id(last(ade_dslist)))(ade_dwgproplistdwg_id"layer")

Thereturnedlisthastheform

("water""sewer""electric")

Page 185: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgquickviewDrawingFunctions

Displaysaquickviewofadrawing.

(ade_dwgquickviewdwg_id)

ReturnsTornil.

dwg_id DrawingID(real)

Thefollowingcodedisplaysquickviewsofalldrawingsintheproject.

(foreachdwg_id(ade_dslist)(if(not(ade_dwgquickviewdwg_id))(princ(strcat"\nProblemviewingdrawing:"(ade_dwggetsettingdwg_id"dwgname")))))

Page 186: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgselectdlgDrawingFunctions

DisplaystheSelectDrawingsdialogbox.

(ade_dwgselectdlg[parent[caption]])

Returnsalistofselecteddrawings,eachrepresentedbyitsaliaspath(string),ornilifnodrawingsareselected.

parent IntegervaluedefiningthepointertotheSelectDrawingsdialogboxparentwindow,whichisexpectedtoberepresentedbyaCWndobject.0meansthattheparentwindowisnotdefined.

caption AstringthatisshownbeforethecurrentdirectoryinthecaptionoftheSelectDrawingsdialogbox.

Page 187: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgsetofDrawingFunctions

Identifiesthedrawingstowhichagivendrawingisattached.

(ade_dwgsetofdwg_id)

ReturnsalistofdrawingIDs(real)ornil.

dwg_id DrawingID(real)

Youcannotusethisfunctiontocheckifadrawingisattachedtotheprojectdrawing.Useade_dwgistoplevelinstead.Ifadrawingisattachedtoboththeprojectdrawingandtootherdrawings,thisfunctionreturnsalistoftheIDsoftheotherdrawingsonly.

Page 188: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgsetsettingDrawingFunctions

Setsadrawingsettingvalue.

(ade_dwgsetsettingdwg_idproplist)

ReturnsTifsuccessfulandthedrawingisactive,ornil.

dwg_id DrawingID(real).

proplist Listcomposedofasettingnameandavalue(string).SeeSettingNamesbelow.

SettingNames

Settingname Value

dwgname Drawingname(string);afullpathname,suchasc:\\drawings\\mydwg.dwg.

dwgdesc Drawingdescription(string)

t_scale Simpletransformscale(real).Forexample,1.2=120%

t_rotate Simpletransformrotation(real);rotationdirectiondependsontheAutoCADANGDIRsetting

t_xoffset SimpletransformXoffset(real)

Page 189: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

t_yoffset SimpletransformYoffset(real)

t_apply Flagvalue(integer).Values:1=applyallsimpletransformationsdefinedforthegivendrawing0=donotapplytransformations

saveback Savebackcoordinates,asequenceofcornerpoints,inthisorder:lowerleft,lowerright,upperright,upperleft,separatedby"."

Thefollowingcodesampleusesthe"saveback"valueoftheproplistparameter—asequenceofcornerpoints:lowerleft,lowerright,upperright,upperleft.

(setqdwg_id(car(ade_dslist)))(ade_dwgsetsettingdwg_id'(("dwgdesc"."SampleDrawingDescription")))(ade_dwgsetsettingdwg_id'(("saveback".((2.202864.99866)(20.46894.99866)(20.468912.3563)(2.2028612.3563)))))

Page 190: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgunlockDrawingFunctions

Removesallobjectlocksfromadrawing.

(ade_dwgunlockdwg_id)

ReturnsTornil.

dwg_id DrawingID(real)

Usingthisfunctionrequiressuperuserprivileges.

Page 191: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_dwgzoomextentsDrawingFunctions

Zoomstotheextentsoftheactivedrawings.

(ade_dwgzoomextents)

ReturnsTornil.

Page 192: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editdefcenObjectEditingFunctions

Definesanewlabelpointforanobject.

(ade_editdefcenenamept)

ReturnsTornil.

ename AutoCADentityname.

pt Labelpoint,alistofrealvaluesdefinedin2Dor3Dpoint(point)

Usethisfunctionwithpropertyalterationifthecurrentlabelpointisnotsuitableforthetextobjectyouareadding.

Thefollowingexamplesetsthelabelpointofthelastobjectto(5,5).

(setqpt1'(55))(setqent1(entlast))(ade_editdefcenent1pt)(ade_expreval(entlast)".labelpt""point")

Page 193: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editlockederasedObjectEditingFunctions

Getstheobjectsinthesavesetthathavebeenerased.

(ade_editlockederased)

Returnsaselectionsetornil.

Theseareobjectsthatwereerasedintheprojectdrawingandarenowqueuedforsavebacktosourcedrawings.

(setqss_erased(ade_editlockederased))

Page 194: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editislockedObjectEditingFunctions

Getslockinformationaboutanobjectifitislocked.

(ade_editislockedename)

Returnsalistoflockinformationaboutthespecifiedobjectiflocked,orifnotlocked,thennil.

ename AutoCADentityname.

Thelistoflockinformationreturnedbythisfunctioncontainsthefollowingstrings,inorder:

Loginnameoftheuserwholockedtheobject.Nameandpathofthedrawingthatcontainstheobject.Datetheobjectwaslocked.Timetheobjectwaslocked.Nameandpathoftheprojectdrawing.

Forexample:

("login""c:\\path\\drawing.dwg""7/1/2000""9:58:36AM""c:\\path\\project.dwg")

Page 195: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

YoucanchangetheformatofthedateandtimestringsthroughoptionsintheInternationaldialogboxintheMicrosoftWindowsControlPanel.

Page 196: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editlockedObjectEditingFunctions

Getstheobjectsinthesavesetthathavebeenmodifiedorarenew.

(ade_editlocked)

Returnsaselectionsetornil.

Theseareobjectsthatweremodifiedintheprojectdrawingoraddedtoitandarenowqueuedforsavebacktosourcedrawings.

(setqss_modified(ade_editlocked))

Page 197: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editlockobjsObjectEditingFunctions

Locksasetofobjectsandaddsthemtothesaveset.

(ade_editlockobjssel_set)

Returnsthenumberofobjectslocked(real)ornil.

sel_set Selectionsetname.

Thefunctionlockstheobjectscontainedinthedesignatedselectionset.Lockingtheseobjectsaddsthemtothesaveset.

Itisagoodideatocomparethenumberofobjectslockedwiththenumberofobjectsinthedesignatedselectionset.Ifthenumberlockedislessthanthenumberintheselectionset,anerroroccurredinthelockingprocess,andyoushouldchecktheerrorstack.

Thefollowingexamplecreatesaselectionset,addsitsobjecttothesaveset,andcheckstheresult.

(entmake'((0."circle")(62.1)(1012.02.00.0)(40.1.0)));Getthenewentity.(setqe(entlast));Createaselectionsetcontaininge.

Page 198: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqss(ssadde));Checkhowmanyobjectsinss.(setqnum_tolock(sslengthss));Locktheobjectsinssandgetthenumberlocked.(setqnum_locked(fix(ade_editlockobjsss)));Fixtruncatestherealreturnvalueof;ade_editlockobjs.(if(equalnum_tolocknum_locked)(progn(princ"\nObjectslocked"(princ"andaddedtosaveset:")(princnum_locked))(princ"\nUh-oh"))

Page 199: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editnewObjectEditingFunctions

Getstheobjectsinthesavedsetthatarenew.

(ade_editnew)

Returnsaselectionsetornil.

Theseareobjectsthatwereaddedtotheprojectdrawingandarenowqueuedforsavebacktosourcedrawings.

(setqss_modified(ade_editnew))

Page 200: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_editunlockobjsObjectEditingFunctions

Unlocksasetofobjectsandremovesthemfromthesaveset.

(ade_editunlockobjssel_set)

Returnsthenumberofobjectsunlocked(real),ornil.

sel_set Selectionsetname.

Thefunctionunlockstheobjectsinthespecifiedselectionset.Iftheselectionsetisnil,thefunctionunlocksallerasedobjects.Unlockingobjectsremovesthemfromthesaveset.

Page 201: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_entsetlocationOtherFunctions

Setsanewentitylabelpoint

(ade_entsetlocationenamept)

ReturnsTornil

ename AutoCADentityname.

pt Newlabelpointlocation,a2Dor3Dpoint(point)

Thisfunctionsetsanewlabelpointforanobject.Anobject'slabelpointisthestartingpositionfortextaddedduringaquerypropertyalteration.Bydefault,thecentroidoftheobjectisthelabelpoint.

Thisfunctionsetsthelabelpointasdefinedbythepointargument.

Page 202: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errclearErrorMessageFunctions

Clearstheerrorstack.

(ade_errclear)

ReturnsTornil.

Page 203: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errcodeErrorMessageFunctions

Getstheerrorcodeforagivenerrorinthestack.

(ade_errcodeerr_index)

Returnsanerrorcode(integer)ornil.

err_index Positionoftheerrorinthestack(integer),where0=firsterror

Page 204: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errgetlevelErrorMessageFunctions

Getsthesystemerrorlevel.

(ade_errgetlevel)

Returnsanerrorlevel(integer)ornil.

Thesystemerrorleveldetermineswhicherrortypesarepushedtothestack.

ErrorLevels

0 Allerrorsarepushed.

1 Allerrorsexceptwarningsanddiagnosticsarepushed(theirtypesarelistedbelow).

2 Noerrorsarepushed.

Thefollowingerrortypesaresuppressediftheerrorlevelis1.

SuppressedErrorTypes

01 kAdeWarning ADE(AutoCADDataExtension)executionwarning.

03 kAseWarning ASE(AutoCADSQLExtension)executionwarning.

05 kAcWarning AutoCADexecutionwarning.

07 kAsiWarning ASI(AutoCADSQLInterface)executionwarning.

Page 205: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

09 kIRDWarning Extendedobjectdata(Xdata)warning.

16 kDiagMessage Diagnosticmessagereturned.

Errorsthatarenotpushedtotheerrorstackarenotdisplayedintheerrordialogintheuserinterface,andtheyarenotaccessiblebyanyerrormessagefunction.

Theerrorlevelmanagedbyade_errgetlevelandade_errsetlevelhasnothingtodowiththeerrorlevelmanagedbyade_prefgetvalandade_prefsetval(theworksessionpreference,LogMessageLevel).Thelatteraffectswhichtypesofmessagearewrittentothelogfile.

Theerrorlevelisnotsavedwhenasessionends.Whenasessionbegins,theerrorlevelisalways0.

Page 206: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errmsgErrorMessageFunctions

Getstheerrormessageforagivenerrorinthestack.

(ade_errmsgerr_index)

Returnsanerrormessage(string)ornil.

err_index Positionoftheerrorinthestack(integer),where0=firsterror.

Page 207: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errpushErrorMessageFunctions

Pushesanerrortothestack.

(ade_errpush[err_code][level]message)

ReturnsTornil.

err_code Errorcode(detailsbelow).

level Errorlevel(string).Values:"warning","error"(default),ortheemptystring.Iftheemptystring,theerrorlevelis"error".

message Errormessage(string).

Ifyourapplicationwillusecustomerrorcodes,definearangeforthemthatdoesnotconflictwithanyrangeusedforAutoCADMaperrorcodes.Tospecifyageneralerror,lettheerr_codeargumentbe1(kAdeErr).

Thevalidlevelvalues,"warning",and"error",correspondrespectivelytothefollowingerrortypes:

1 kAdeWarning

2 kAdeError

Foralistofallerrortypes,includingthetwothatarevalidlevelvalues,seeErrorTypes.

Page 208: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thefollowingexamplepushesanerrortothestack.

(ade_errpush1"error""messagetext")

Page 209: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errpushstatementErrorMessageFunctions

PushesafaultySQLstatementtotheerrorstack.

(ade_errpushstatementstatementposition)

ReturnsTornil.

statement Faultystatementthatcausedtheerror(string)

position Startingpositionoftheerrorinthefaultystatement(integer).Position1correspondstothefirstcharacter.

Thisfunctionisdesignedtoadddiagnosticinformationtoanerroryouhavejustpushed.Itisassociatedwiththelatesterrorinthestackonly.Acalltoade_errpushstatementmakessenseonlyifacalltoade_errpushimmediatelyprecedesit.

Page 210: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errqtyErrorMessageFunctions

Returnsthenumberoferrorsinthestack.

(ade_errqty)

Returnsanerrorcount(integer)ornil.

Page 211: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errsetlevelErrorMessageFunctions

Setsthesystemerrorlevel.

(ade_errsetlevellevel)

ReturnsTornil.

level Errorlevel(integer):0,1,or2

Seeade_errgetlevelfordetails.

Page 212: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errshowdlgErrorMessageFunctions

DisplaystheMapMessagesdialogbox.

(ade_errshowdlg)

ReturnsTornil.

Iftherearenoerrorsormessagesintheerrorstack,thedialogboxdoesnotdisplay,andthefunctionreturnsnil.

Page 213: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errstatementErrorMessageFunctions

GetsthefaultySQLstatementforagivenerrorinthestack.

(ade_errstatementerr_index)

ReturnsthefaultySQLstatementwitherrorpositionornil.

err_index Positionoftheerrorinthestack(integer)0=firsterror

TheSQLstatementanderrorpositionarereturnedinthefollowingformat.

(faulty_statementerr_pos)

Thefaulty_statementstringquotesthefaultySQLstatementthatcausedtheerror.Theerr_posvalueidentifiesthestartingpositionoftheerrorinthefaultystatement.Position1isthefirstcharacterofthestatement.

Theexpression(ade_errstatement2),whichreferencesthethirderrorinthestack,couldreturn

("xxx"6)

where"xxx"isthefaultystatementand6tellsyouthatthetroublebeginsatthesixthcharacter.

Page 214: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_errtypeErrorMessageFunctions

Getsthetypeofagivenerrorinthestack.

(ade_errtypeerr_index)

Returnsanerrortype(integer)ornil.

err_index Positionoftheerrorinthestack(integer),where0=firsterror.

Page 215: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_expreval

Evaluatesanexpression.

(ade_expreval[ename]exprtype)

Returnsthevalueoftheexpressionornil.

ename Optionaldrawingobjectname.Requirediftheexpressionusesobjectpropertiesordata.

expr Expressiontoevaluate(string)

type Expectedreturntype(string):"short","long","real","string",or"point".

Iftheexpressionusesobjectpropertiesordata,youmustspecifythenameofadrawingobject.Forexample,ifthetheexprargumentis"(+56)",noenameargumentisrequired,buttoevaluate"(+".COLOR"6)"youneedanobjecttosupplythecolor.

Thefollowingexamplegetstheareaofaselectedobject:

(setqmyobject(car(entsel"Selectanobject:")))(setqvalue(ade_exprevalmyobject".area""real"))

Dependingonwhatyouspecifyforthetypeargumentintheprecedingexample,theresultcanbeanintegerorastring,asthefollowingtwoexamples

Page 216: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

demonstrate.Supposetheareaofmyobjectis2.7.Thefirstexpressionreturnsthisareaas2;thesecondreturnsitas"2.7".

(ade_exprevalmyobject".area""short")

(ade_exprevalmyobject".area""string")

NoteIftheexprargumentisanintegercalculationandyousupply"string"forthetypeargument,theresultingstringdoesnotcontainaninteger,butareal.Forexample,thefollowingexpressionreturns"2.0",not"2".

(ade_expreval"(+11)""string")

Ifyouwantthestringtocontainaninteger,includethefixfunctionintheexprargument.

(ade_expreval"(fix(+11))""string")

Theade_exprevalfunctioncanreturnanintegerstringsolongasthereturnvalueisnottheresultofanintegercalculation.Forexample,thefollowingcodereturnsanintegerstringwithoutusingfix.

(setqobj(car(entsel"Selectanobject:")))(setqobjcolor(ade_exprevalobj".color""string")))

Togetthecentroidandthelayernameofthesameobject,addtheselines:

(setqobjcentr(ade_exprevalobj".centroid""point"))(setqobjlayer(ade_exprevalobj".layer""string"))

Page 217: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_keycolumnlistSQLEnvironmentFunctions

Returnsalistofthekeycolumnnamesforthespecifiedlinktemplate.

(ade_keycolumnlistlinktemplate)

Returnsalistofkeycolumnnamesornil.

linktemplate Linktemplate(string)

FormoreinformationaboutlinktemplatesandusingSQL,seetheAutoCADonlinedocumentation.

Page 218: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odaddfieldObjectDataFunctions

Addsfieldstoatable.

(ade_odaddfieldtabnamefieldlist)

ReturnsTornil.

tabname Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

fieldlist Listoffieldstoadd.Asequenceoffielddefinitions.

Asequenceoffielddefinitionsisintroducedbythestring"columns".Eachfielddefinitionisalistofa-lists,andeacha-listconsistsofafieldpropertyandavalue,asfollows:

Fieldproperty Value

colname Fieldname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

coldesc Fielddescription(string)

coltype Fielddatatype

defaultval Defaultfieldvalue

Page 219: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thefunctionaddsfieldstothetableandtoeachofitsrecords.Ineachrecord,thenewfieldsareassigneddefaultvaluesinaccordwiththeirfielddefinitions.Thefunctionhasnoeffectonexistingfields.Inotherwords,thefunctionaddsfieldstoeachsetofobjectdatadefinedbythetableandattachedtoanobject.

Foranexample,seeAddingFieldstoaTable.

Page 220: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odaddrecordObjectDataFunctions

Attachesdatatoanobject.

(ade_odaddrecordenametable)

ReturnsTornil.

ename AutoCADobjectname.

table Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Attachingdatatoanobjectisalsocalledattachingatabletoanobject.Thisfunctionattachesanewrecordinaspecifictabletoaspecificobject.Typically,arecordcontainsinformationaboutwhateveritisthattheobjectrepresents.Forexample,ifalineinadrawingrepresentsasectionofpipeinawatersystem,anattachedrecordcouldcontaininformationaboutthatsection.

Whenanewrecordisattached,itsfieldscontaindefaultvaluesthatcorrespondtotheirfielddefinitions.Togetafieldvalue,useade_odgetfield;tochangeit,useade_odsetfield.Fielddefinitionsareincludedinthetabledefinition.Seeade_oddefinetabforinformationabouttabledefinitions.

Youcanattachmorethanonerecordtothesameobjectwithadditionalcallstoade_odaddrecord.Theadditionalrecordscanbemembersofthesameordifferenttables.Ifanobjecthasonlyonerecordfromagiventable,thenumberofthatrecordis0.Ifyouattachasecondrecordfromthesametable,thenumber

Page 221: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ofthatrecordis1,andsoon.Useade_odrecordqtytofindhowmanyrecordsofagiventableareattached.

Forexample,ifasectionofwaterpipeisinspectedatintervals,youcouldattachanumberofrecordsoftheWATERINSPECTIONtabletothesamelineintheWATERdrawing,andeachrecordcouldcontaintheresultofadifferentinspection.

Page 222: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odattachrecordObjectDataFunctions

Attachesanewrecordtoanobject.

(ade_odattachrecordenamerec_id)

ReturnsTornil.

ename AutoCADobjectname.

rec_id RecordIDreturnedbyade_odnewrecord

Page 223: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_oddefinetabObjectDataFunctions

Createsanobjectdatatable.

(ade_oddefinetabtab_defn)

ReturnsTornil.

tab_defn Listoftableelements:thetablename,thetabledescription,andasequencefielddefinitions.

Thetablenameisspecifiedbyana-list:

("tablename"."NEWTABLE")

Thenamemustbeunique,containnospaces,andstartwithacharacter.Thenamecanbeupto25characterslong.

Thetabledescriptionisspecifiedthesameway,exceptthatspacesareallowed:

("tabledesc"."NewSampleTable")

Thefielddefinitionsareintroducedbythestring,"columns".Atleastonefielddefinitionisrequired.Eachfielddefinitionisalistofa-lists,andeacha-listconsistsofafieldpropertyandavalue,asfollows:

Page 224: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Fieldproperty Fieldname

colname Fieldname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

coldesc Fielddescription(string)

coltype Fielddatatype

defaultval Defaultfieldvalue

Thefollowingcodecreatesatable.

;Definenewtable(setqtabldefn'(("tablename"."NEWTABLE")("tabledesc"."NewSampleTable")("columns";Defineafield(("colname"."FIELD1")("coldesc"."Field1Description")("coltype"."character")("defaultval"."DefaultValue"));Definemorefieldsasneeded...;Foranexampleofdefiningfields,click .)));Createthenewtable(ade_oddefinetabtabldefn)

Hereisanotherexampleofcreatingatable.

Page 225: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqpt1"2,2")(ade_oddefinetab(list'("tablename"."valve_id")'("tabledesc"."ValveStorage")(list"columns"(list'("colname"."LOCATION")'("coldesc"."Valve_id")'("coltype"."point")(cons"defaultval"pt1))))

Page 226: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_oddeletefieldObjectDataFunctions

Deletesfieldsfromatable.

(ade_oddeletefieldtabnamefieldlist)

ReturnsTornil.

tabname Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

fieldlist Listoffieldnames(string)

Thefunctiondeletesthefieldsfromthetableandfromeachofitsrecords.Thedatacontainedinthesefieldsisalsodeleted.Inotherwords,itdeletesthefieldsandtheirdatafromeachsetofobjectdatadefinedbythetableandattachedtoanobject.

NoteThefieldlistargumentforade_oddeletefieldisalistoffieldnamesonly.Inthecompanionfunctions,ade_odaddfieldandade_odmodifyfield,itisalistoffielddefinitions.

Theade_oddeletefieldfunctionaffectsallactivedrawingsinthedrawingset.Thereshouldnotbeanyqueriedobjectsforthisoperation.

NoteThisfunctionwillnotoperateunlessyourenduserhassuperuserprivileges.

Thefollowingcodedeletesthreefieldsfromatable.

Page 227: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_oddeletefield"table1"'("field1""field2""field3"))

Page 228: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_oddeletetabObjectDataFunctions

Deletesatable.

(ade_oddeletetabtabname)

ReturnsTornil.

tabname Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Thefunctiondeletesatableandallofitsrecords.Itdeleteseverysetofobjectdatadefinedbythetableandattachedtoanobject,aswellasthedatacontainedintherecords.

Theade_oddeletetabfunctionaffectsallactivedrawingsinthedrawingset.Thereshouldnotbeanyqueriedobjectsforthisoperation.

NoteThisfunctionwillnotoperateunlessyourenduserhassuperuserprivileges.

Page 229: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_oddelrecordObjectDataFunctions

Deletesarecord.

(ade_oddelrecordenametablerecnum)

ReturnsTornil.

ename AutoCADentitynameoftheobjecttowhichtherecordisattached.

table Nameofthetabletowhichtherecordbelongs,upto25characterslong(string).Mustbeunique,containnospaces,andstartwithacharacter

recnum Recordnumber(integer).Thenumberofthefirstrecordis0

Thefunctiondeletestherecordfromtheobject.Itdeletesthesetofobjectdatadefinedbythetableandattachedtotheobject.Thisdeletestherecordfromthetableaswellasthedatacontainedintherecord.

Therecordnumberisnecessarybecausemorethanonerecordfromthesametablecanbeattachedtoanobject.Useade_odrecordqtytofindhowmanyrecordsofagiventableareattached.

Page 230: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odfreerecObjectDataFunctions

Freesthememoryclaimedindefininganewrecord.

(ade_odfreerecrec_id)

ReturnsTornil.

rec_id RecordIDreturnedbyade_odnewrecord

WarningYoumustreleaseanewrecordwhenyouarefinishedwithit.

Page 231: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odgetfieldObjectDataFunctions

Getsafieldvalue.

(ade_odgetfieldenametablefieldrecnum)

Returnsafieldvalue(datatypevaries)ornil.

ename AutoCADobjectname.

table Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

field Fieldname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

recnum Recordnumber(integer).Thenumberofthefirstrecordis0

Toidentifyauniquerecord,youneedtospecifythetabletowhichitbelongs,theobjecttowhichitisattached,anditsrecordnumber.Therecordnumberisnecessarybecausemorethanonerecordfromthesametablecanbeattachedtoanobject.Formoreinformationaboutrecordsandrecordnumbers,seeade_odaddrecord.

Thefieldvaluereturnedcanbeoneoffourdatatypes:integer,character,point,orreal.

Page 232: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odgetrecfieldObjectDataFunctions

GetsafieldvalueusingarecordID.

(ade_odgetrecfieldrecIDfield)

Returnsafieldvalue(datatypevaries)ornil.

recID RecordID(real)returnedbyade_odgetrecord

field Fieldname(string)

ThisfunctionusestherecordIDassignedbyade_odgetrecordtogetthevalueofaparticularfield.Thismeansofgettinganobjectdatafieldvalueisgenerallyfasterthananyother.

Page 233: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odgetrecordObjectDataFunctions

GetsarecordID.

(ade_odgetrecordenametablerecnum)

ReturnsarecordID(real)ornil.

ename AutoCADobjectname.

table Tablename(string)

recnum Recordnumber(integer);thefirstrecordnumberis0

ThefunctionassignsanIDtotherecorduniquelydeterminedbythethreearguments.LateryoucanusethisrecordIDwithade_odgetrecfieldtoreturnthevalueofaparticularfieldofthisrecord.Thismeansofgettinganobjectdatafieldvalueisgenerallyfasterthananyother.

ThreeargumentsarenecessarybecauseanAutoCADobjectcanbeassociatedwithmorethanonerecordinatable,inwhichcasetherecordsaredistinguishedbytheirrecordnumbers.Ifthereisonlyonerecord,itsnumberis0.Formoreinformationaboutrecordsandrecordnumbers,seeade_odaddrecord.

Page 234: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odgettablesObjectDataFunctions

Liststhetablesattachedtoanobject.

(ade_odgettablesename)

Returnsalistoftablenames(string)ornil.

ename AutoCADobjectname.

Anobjectcanhaverecordsofmorethanonetableattached.Thisfunctionlistsallthetablesthathaverecordsattachedtotheobject.Seeade_odaddrecordforinformationaboutrecordsattachedtoobjects.

Anobjectcanhavemorethanonerecordfromthesametableattached.Tofindhowmanyrecordsofagiventableareattached,useade_odrecordqty.

Page 235: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odmodifyfieldObjectDataFunctions

Modifiesfieldpropertiesinatable.

(ade_odmodifyfieldtableNamefieldList)

ReturnsTornil.

tableName Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

fieldList Fieldstomodify.Asequenceoffielddefinitions.SeeFieldDefinitionsbelow.

Theade_odmodifyfieldfunctionaffectsallactivedrawingsinthedrawingset.Thereshouldnotbeanyqueriedobjectsforthisoperation.

NoteThisfunctionwillnotoperateunlessyourenduserhassuperuserprivileges.

FieldDefinitions

Thefielddefinitionsareintroducedbythe"columns"string.Eachfielddefinitionisalistofa-lists,andeacha-listconsistsofafieldpropertyandavalue,asfollows:

FieldProperty FieldValue

Page 236: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

colname Fieldname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

coldesc Fielddescription(string)

coltype Fielddatatype

defaultval Defaultfieldvalue

Inthefieldlistargument,specifythefieldstomodifyandtheirnewfielddefinitions.Thefunctionactsonthesefieldsonlyandhasnoeffectonanyothers.Foreachfieldyouspecify,thefunctionreplacestheexistingfielddefinitionwiththenewfielddefinitioninthetableandineachofitsrecords.Ineachrecord,themodifiedfieldsareassigneddefaultvaluesthatcorrespondtotheirnewfielddefinitions.Inotherwords,thefunctionreplacesfielddefinitionsineachsetofobjectdatadefinedbythetableandattachedtoanobject.

Thefieldlistargumenthasthesameformatasthefieldlistargumentinade_odaddfield.Theentryforthisfunctionhassourcecodeexamples.

Ifanewfielddefinitionchangesthefieldtype,fieldvaluesinexistingrecordsareconvertedtothenewtypeifpossible.Thisconversionmayalterthevalues.Forexample,ifyouchangethefieldtypefromrealtointeger,existingfieldvaluesareconvertedbytruncatingtheirdecimalparts.

Page 237: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odmodifytabObjectDataFunctions

Redefinesatable.

(ade_odmodifytabtab_defn)

ReturnsTornil.

tab_defn Listoftableelements:thenameofthetableyouwillredefine,anewtabledescription,andasequenceofnewfielddefinitions.

Thetab_defnargumenthasthesameformatasthetab_defnargumentinade_oddefinetab.Theentryforthisfunctionhassourcecodeexamples.

Forthetableyouspecifyinthetab_defnargument,thefunctionreplacestheexistingtabledefinitionwiththenewone.Foreveryobjecttowhichthetableisattached,thecorrespondingfieldsofeachrecordofthetablearereplaced.Theoldfieldsaredeleted,andthenewfieldsareassigneddefaultvaluesinaccordwiththeirfielddefinitions.

Theade_odmodifyfieldfunctionaffectsallactivedrawingsinthedrawingset.Thereshouldnotbeanyqueriedobjectsforthisoperation.

NoteThisfunctionwillnotoperateunlessyourenduserhassuperuserprivileges.

Page 238: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odnewrecordObjectDataFunctions

Definesanewobjectdatarecord.

(ade_odnewrecordtable)

ReturnsanewrecordIDornil.

table Tablename(string),theexistingtabletowhichthenewrecordwillbelong.

Thefunctioncreatesanewrecord,populatesitsfieldswithdefaultvaluesaccordingtothetabledefinition,andreturnsthenewrecordID.

Page 239: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odpresetfieldObjectDataFunctions

Assignsavaluetoafieldinanewrecord.

(ade_odpresetfieldrec_idfieldvalue)

ReturnsTornil.

rec_id RecordIDreturnedbyade_odnewrecord

field Fieldname(string)

value Fieldvalue.

SetsthevalueofafieldinanObjectDatarecorddefinedthroughade_odnewrecord.

Page 240: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odrecordqtyObjectDataFunctions

Countstherecordsattachedtoanobject.

(ade_odrecordqtyenametable)

Returnsarecordcount(integer)ornil.

ename AutoCADobjectname.

table Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

Thefunctioncountshowmanyrecordsofthesametableareattachedtotheobject.Seeade_odaddrecordformoreinformationaboutattachingrecordstoobjects.

Page 241: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odsetfieldObjectDataFunctions

Setsafieldvalue.

(ade_odsetfieldenametablefieldrecnumvalue)

ReturnsTornil.

ename AutoCADobjectname.

table Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

field Fieldname(string)canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

recnum Recordnumber(integer);thefirstrecordnumberis0.

value Newfieldvalue.

Toidentifyauniquerecord,youneedtospecifythetabletowhichitbelongs,theobjecttowhichitisattached,anditsrecordnumber.Therecordnumberisnecessarybecausemorethanonerecordfromthesametablecanbeattachedtoanobject.Formoreinformationaboutrecordsandrecordnumbers,seeade_odaddrecord.

Page 242: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odtabledefnObjectDataFunctions

Getsatabledefinition.

(ade_odtabledefntable)

Returnsatabledefinitionornil.

table Tablename(string)canbeupto25characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Thetabledefinitionreturnedbyade_odtabledefnhasthesameformatasthetab_defnargumentinade_oddefinetab.Theentryforthisfunctionhassourcecodeexamples.

Page 243: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_odtablelistObjectDataFunctions

Liststhetablesintheproject.

(ade_odtablelist)

Returnsalistoftablenames(string)ornil.

Thelistincludesallobjectdatatablesintheprojectdrawingandinallactivesourcedrawings.

Page 244: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_osfexpand

Searchesadirectoryandreturnsalistoffilenames.

(ade_osfexpandpathextensionpattern)

Returnsalistoffilenamesornil.

path Directoryinwhichtosearch(string)ornil.Ifnil,thefunctionsearchestheworkingdirectory

extension Filenameextension(string)ornil.Ifnil,thefunctionuses"dwg".

pattern Wildcardpattern(string)ornil.Ifnil,thefunctionuses"*"(searchforallfilenameswiththegivenextensionandpath).

Forinformationaboutwildcardpatterns,lookup"wild-cardcharacters"ontheIndextabofAutoCADMapHelp.

Page 245: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projgetctgynameCoordinateTransformationFunctions

Identifiesthecategorythatacoordinatesystembelongsto.

(ade_projgetctgynamecscode)

Returnsacoordinatesystemcategory(string)ornil.

cscode Coordinatesystemcode(string),eightcharacters

Page 246: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projgetinfoCoordinateTransformationFunctions

Getsinformationaboutaprojectionsystem.

(ade_projgetinfocscodeinfo_type)

Returnsapieceofprojectionsysteminformationornil.

cscode Coordinatesystemcode(string),eightcharacters

info_type Informationtype(string);seeInformationTypesbelow

InformationTypes

description Description(string).Forexample,"WorldGeodeticSystemof1984Latitude/LongitudeinDegrees".

projection Projection(string).Forexample,"UnityConversion,produce/acceptlat/longs".

datum Datum(string).Forexample,"NorthAmericanDatumof1927,MeanValues".

Page 247: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projgetwscodeCoordinateTransformationFunctions

Getstheprojectdrawing'scoordinatesystemcode.

(ade_projgetwscode)

Returnsacoordinatesystemcode(string)ortheemptystring.

Page 248: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projlistcrdsystsCoordinateTransformationFunctions

Listsavailablecoordinatesystemsinagivencategory.

(ade_projlistcrdsystscategoryname)

Returnsalistofavailablecoordinatesystemsornil

categoryname Coordinatesystemcode(string),eightcharacters.

Page 249: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projlistctgyCoordinateTransformationFunctions

Listsavailablecoordinatesystemcategories.

(ade_projlistctgy)

Returnsalistofcoordinatesystemcategoriesornil.

Page 250: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projptbackwardCoordinateTransformationFunctions

Convertspointcoordinatesfromdestinationcoordinatesystemtosource.

(ade_projptbackwardpt)

Returnscorrespondingsourcevaluesornil.

pt Destinationpointtoconvert,asetof2Dor3Dcoordinatevalues(real).If3D,theZvalueisignored.

Beforeyoucanuseade_projptbackwardtoconvertpoints,youmustfirstidentifythecoordinatesystemsthatyouareconvertingbetween.Useade_projsetsrctosetthesourcesystemandade_projsetdesttosetthedestinationsystem.Theade_projptbackwardfunctionassumesthatthecoordinatevaluesyoupasstoitbelongtothedestinationsystem,anditreturnscorrespondingsourcevalues.Theade_projptforwardfunctiondoestheinverse.

Formoreinformation,seeConvertingCoordinates.

Page 251: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projptforwardCoordinateTransformationFunctions

Convertspointcoordinatesfromsourcecoordinatesystemtodestination.

(ade_projptforwardpt)

Returnscorrespondingdestinationvaluesornil.

pt Sourcepointtoconvert,asetof2Dor3Dcoordinatevalues(real).If3D,theZvalueisignored.

Beforeyoucanuseade_projptforwardtoconvertpoints,youmustfirstidentifythecoordinatesystemsthatyouareconvertingbetween.Useade_projsetsrctosetthesourcesystemandade_projsetdesttosetthedestinationsystem.Theade_projptforwardfunctionassumesthatthecoordinatevaluesyoupasstoitbelongtothesourcesystem,anditreturnscorrespondingdestinationvalues.Theade_projptbackwardfunctiondoestheinverse.

Formoreinformation,seeConvertingCoordinates.

Page 252: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projsetdestCoordinateTransformationFunctions

Setsthedestinationcoordinatesystemforconvertingpoints.

(ade_projsetdestcscode)

ReturnsTornil.

cscode Coordinatesystemcode(string),eightcharacters.

Beforeyoucanuseeitherade_projptforwardorade_projptbackwardtoconvertpoints,youmustfirstidentifythecoordinatesystemsthatyouareconvertingbetween.Useade_projsetdesttosetthedestinationsystemandade_projsetsrctosetthesourcesystem.Theade_projptforwardfunctionassumesthatthecoordinatevaluesyoupasstoitbelongtothesourcesystem,anditreturnscorrespondingdestinationvalues.Theade_projptbackwardfunctiondoestheinverse.

Formoreinformation,seeConvertingCoordinates.

Page 253: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projsetsrcCoordinateTransformationFunctions

Setsthesourcecoordinatesystemforconvertingpoints.

(ade_projsetsrccscode)

ReturnsTornil.

cscode Coordinatesystemcode(string),eightcharacters.

Beforeyoucanuseeitherade_projptforwardorade_projptbackwardtoconvertpoints,youmustfirstidentifythecoordinatesystemsthatyouareconvertingbetween.Useade_projsetsrctosetthesourcesystemandade_projsetdesttosetthedestinationsystem.Theade_projptforwardfunctionassumesthatthecoordinatevaluesyoupasstoitbelongtothesourcesystem,anditreturnscorrespondingdestinationvalues.Theade_projptbackwardfunctiondoestheinverse.

Formoreinformation,seeConvertingCoordinates.

Page 254: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_projsetwscodeCoordinateTransformationFunctions

Setsthecoordinatesystemfortheprojectdrawing.

(ade_projsetwscodecscode)

ReturnsTornil.

cscode Coordinatesystemcode(string),eightcharacters

Page 255: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qldelctgyQueryLibraryFunctions

Deletesaquerylibrarycategory.

(ade_qldelctgyctgy_id)

ReturnsTornil.

ctgy_id CategoryID(real)

Page 256: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qldelqueryQueryLibraryFunctions

Deletesaqueryfromthequerylibrary.

(ade_qldelqueryqry_id)

ReturnsTornil.

qry_id QueryID(real)

Page 257: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlgetctgyinfoQueryLibraryFunctions

Getsinformationaboutaquerycategory.

(ade_qlgetctgyinfoctgy_idinfo)

Returnstherequestedinformationornil.

ctgy_id CategoryID(real)

info Typeofcategoryinformationtoget(string):"name"togetthecategoryname,or"qrylist"togetalistofqueryIDsofthequeriesinthecategory.

Theinformationreturneddependsontheinfoargumentyouuse,butitisalwaysinlistformat.Forexample:

Anexpressionsuchas(ade_qlgetctgyinfosome_id"name")returnsacategoryname,suchas("SomeCategory").Anexpressionsuchas(ade_qlgetctgyinfosome_id"qrylist")returnsalistofqueryIDs,suchas(1.234562.345673.45678).

Page 258: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlgetqryinfoQueryLibraryFunctions

Getsinformationaboutaquery.

(ade_qlgetqryinfoqry_idinfo)

Returnstherequestedinformationornil.

qry_id QueryID(real).

info Informationtype(string).SeetheInformationTypestablebelow.

InformationTypes

name Queryname.

description Querydescription.

category Categoryname.

qtype Querytype:1=internal,2=external.

filename Foranexternallysavedquery,fullpathname(string).

AquerygetsanameandanIDwhenitissavedtoaquerycategoryofthequerylibrary.AnewquerythatyouhavenotyetsaveddoesnothaveanameoranID.

Page 259: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qllistctgyQueryLibraryFunctions

ListsthequerycategoryIDs.

(ade_qllistctgy)

ReturnsalistofcategoryIDs,oriftherearenocategories,nil.

TofindtheIDofacategoryifitsnameisknown,useade_qllistctgytogetalistofcategoryIDs,andthenuseade_qlgetctgyinfooneachIDinturnuntilyoufindtheIDassociatedwiththename.

Page 260: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlloadqryQueryLibraryFunctions

Makesasavedquerycurrent.

(ade_qlloadqryqry_id)

ReturnsTornil.

qry_id QueryID(real)

Onceloaded,thequerybecomesthecurrentquery.Ifthereisalreadyacurrentquery,thisqueryreplacesit.

Page 261: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlqrygetidQueryLibraryFunctions

GetsaqueryID.

(ade_qlqrygetidquery_name)

ReturnsaqueryIDornil.

query_name Queryname(string)

AquerygetsanameandanIDwhenitissavedtoaquerycategoryofthequerylibrary.AnewquerythatyouhavenotyetsaveddoesnothaveanameoranID.

Thequerynameisenoughtoidentifyaqueryuniquely.Thecategorynameisnotrequired.Withinaproject,notwoqueriescanhavethesamename,eveniftheyaresavedindifferentcategories.

Page 262: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlsetctgynameQueryLibraryFunctions

Changesaquerycategoryname.

(ade_qlsetctgynamectgy_idname)

ReturnsTornil.

ctgy_id QuerycategoryID(real)

name Nameofnewcategory(string),upto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Thecategorynamecannotcontainspaces.

Page 263: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qlsetqueryQueryLibraryFunctions

Changesaqueryname,description,orthecategoryitbelongsto.

(ade_qlsetqueryqry_idinfovalue)

ReturnsTornil.

qry_id QueryID(real)

info Typeofinformationtomodify(string).SeetheInformationTypestablebelow.

value Newvalue(typevaries).SeetheInformationTypestablebelow.

InformationTypes

name Nameofquery(string),upto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter.

description Descriptionofquery(string),upto132characterslong.Cancontainspaces.Mustbeuniqueandstartwithanalphanumericcharacter.

category CategoryID.

Thisfunctiondoesnotchangefilenameorstoragetype.

Page 264: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AquerygetsanameandanIDwhenitissavedtoaquerycategoryofthequerylibrary.AnewquerythatyouhavenotyetsaveddoesnothaveanameoranID.

Page 265: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qryclearQueryFunctions

Clearsthecurrentquery.

(ade_qryclear)

ReturnsToranerrorcode.

Thisfunctionclearsthecurrentquery,includinganytopologyparameters,suchastopologynameandresult.

Page 266: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qryexecuteQueryFunctions

Executesthecurrentquery.

(ade_qryexecute)

Returnsthenumberofqueriedobjects(real).Ifnone,itreturns0.0.

Executingaquerymakesanewselectionsetofthequeriedobjectsifthe"MkSelSetWithQryObj"optionisturnedon,asfollows:

(ade_prefsetval"MkSelSetWithQryObj"T)

Thequeryrunsslowerinthiscasebecauseoftheextraworkinvolved.

ThefollowingcodecapturestheIDofaselectionsetcreatedbyexecutingthecurrentquery.

(ade_prefsetval"MkSelSetWithQryObj"T)(if(>(ade_qryexecute)0.0)(setqqueried_objects(ssget"P"))(princ"\nNoobjectsfound."))(ade_prefsetval"MkSelSetWithQryObj"nil)

The"P"argumentinthessgetcallidentifiesthe"previous"selectionset(theobjectscurrentlyormostrecentlyselected).

Page 267: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

NoteWheneveryoucreateaselectionset,youreplacethepreviousselectionset.Makesureyouknowwhichobjectsyouaregetting.

Page 268: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrygetdwgandhandleQueryFunctions

GetsthesourcedrawingIDandoriginalhandleofaqueriedobject.

(ade_qrygetdwgandhandleename)

ReturnsthedrawingIDandhandleofthequeriedobjectornil.

ename AutoCADentityname.

ThisfunctionreturnstheIDofthesourcedrawingfromwhichtheobjectwasqueriedandthehandlebywhichtheobjectisknowninthatdrawing.

ADSRXequivalent

structresbuf*ade_qrygetdwgandhandle

ads_nameename);

ReturnsthedrawingIDandhandleforthequeriedobjectorNULL.

Youmustreleasetheresbuf.

Page 269: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrygetentlistQueryFunctions

Returnsthelistofentityhandlesforallobjectsthatsatisfythecurrentqueryinaspecificdrawing.

(ade_qrygetentlistdwg_id)

Returnsalistofthehandlesofselectedobjectsornil.

dwg_id DrawingIDofthedrawingtoquery(real)

Thisfunctionexecutesthecurrentqueryandfindsallobjectsthatsatisfyitinthedrawingspecifiedbythedwg_idargument.Theentityhandlesoftheobjectsarereturnedtothecallingfunction.

Onceyouhavethehandletoanobject,youcangettheentitynamewiththeade_qryhandentfunctionanduseittoperformotherfunctions.Forexample,youcoulduseentget(andads_entget)toretrievetheentityanditsdefinitiondata.

ADSRXequivalent

structresbuf*ade_qrygetentlist

ade_iddwg_id);

ReturnsalistofthehandlesofselectedobjectsorNULL.

Page 270: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Youmustreleasetheresbuf.

Page 271: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrygetreptransformQueryFunctions

Checkswhethertransformationisenabledforthecurrentreportquery.

(ade_qrygetreptransform)

ReturnsTiftransformationisenabledorniliftransformationisdisabledorthereportquerytemplateisnotdefined.

ADSRXequivalent

intade_qrygetreptransform();

ReturnsTRUEorFALSE.

Page 272: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrygroupQueryFunctions

Groupsasequenceoftwoormorequeryconditions.

(ade_qrygroupcondition_id1condition_id2)

ReturnsTornil.

condition_id1 IDoffirstconditionofthegroup(real)

condition_id2 IDoflastconditionofthegroup(real)

Thisfunctionaffectsthecurrentquery.

Aquerydefinitionconsistsofasequenceofqueryconditions.Withinsuchasequence,youcandefinesubsequencesoftwoormoreconditionsbygroupingthem(byenclosingtheminparentheses).Youcangroupconditionswhenyoufirstdefinethequery.Seethebggroupsandendgroupsparametersofade_qrydefine.Oryoucandoitlaterusingade_qrygroup.

Whenyoucallade_qrygroup,theconditionyouspecifyasthefirstconditionofthegroup(condition_id1)mustbeapredecessortotheoneyouspecifyasthelast(condition_id2).Thefunctiongroupsthefirstandthelastandanyconditionsinbetween.Forexample,considerthefollowingquerydefinition,whichiscomposedofconditionsA,B,C,andD:

AANDBORCORD

Page 273: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thefunctioncall(ade_qrygroupIDofBIDofD)changesthedefinitionto

AAND(BORCORD)

Toungroupqueries,useade_qryungroup.

Page 274: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qryhandentQueryFunctions

Getstheentitynameforthespecifiedhandle.

(ade_qryhandentdwg_idhandle)

ReturnstheentitynameforthespecifieddrawingIDandhandleornil.

dwg_id IDofthedrawinginwhichtheobjectresides(real)

handle Originalhandleoftheobjectinthespecifieddrawing.

Thisfunctionprovidesaccesstotheentitynameofanobjectinasourcedatabase.

Youmustusetheretrievedentitynameimmediatelybeforeyoucallanyotherfunction(exceptade_expreval)orreturncontroltoAutoCAD.

Onceyouhavetheentitynameofanobject,youcanuseitwithotherfunctions.Forexample,youcoulduseentget(orads_entget)toretrievetheentityanditsdefinitiondata.

Togettheoriginalhandleoftheobjectinthesourcedrawing,usetheade_qrygetentlistfunction.

ToobtainadrawingID,useade_dslist.

TogettheIDofadrawinggivenadrawingfilepath,useade_dwggetid.

Thefollowingcodesampleshowshowyoucancombineade_qrygetentlistandade_qryhandenttocountthenumberofobjectsinthesourcedrawingthat

Page 275: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

areoftypeline.

;clearoutoldquery...(ade_qryclear);defineanewquery(ade_qrydefine'("""""""Location"("All")""))

;initializethecount...(setqtotal_count0)

;foreachdrawinginthedrawingset...(foreachdwg_id(ade_dslist)

;ifthedrawingisactive(if(ade_dwgisactivedwg_id)(progn

;gettheobjectswhichsatisfythequery...(setqhandle_list(ade_qrygetentlistdwg_id))(foreachhandlehandle_list(setqename(ade_qryhandentdwg_idhandle))

;ifit'saline,incrementthecounter(if(=(cdr(assoc0(entgetename)))"LINE")(setqtotal_count(1+total_count)))));progn);if);foreach

ADSRXequivalent

intade_qryhandent(

Page 276: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_iddwg_id,char*handle,ads_nameresult);

ReturnsRTNORMoranerrorcode.

result OutputtheentitynameforthespecifieddrawingIDandhandle.

Page 277: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrylistQueryFunctions

ListstheIDsofthecurrentqueryconditions.

(ade_qrylist)

ReturnsalistoftheIDsofthecurrentqueryconditions,or,ifthereisnocurrentquery,nil.

Page 278: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrysaveQueryFunctions

Savesthecurrentquery.

(ade_qrysavecatnameqryparams)

ReturnsaqueryIDornil.

catname Categoryname(string).Thecategoryiscreatedifitdoesnotexist.

qryparams Listofa-lists,eachcomposedofaninformationtypeandavalue.SeetheInformationTypestablebelow.

InformationTypes

name Queryname(string)

description Querydescription(string)

qtype Howthequeryissaved(integer):1=internal(default),2=external.

filename Foranexternalquery,fullpathname(string).

saveoption Bitcodeforthesaveoptionsyouarechoosing(integer).SeetheSaveOptionstablebelow.

Thefunctionsavesthecurrentquerytotheproject'squerylibraryortoafile.

Page 279: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Aquerysavedtothequerylibraryiscalledaninternalquery.Aquerysavedtoafileiscalledanexternalquery.

Youmustspecifyacategorynameandaqueryname.Inaproject,notwoqueriescanhavethesamename,eveniftheyaresavedindifferentcategories.Thedefaultvalueforadescriptionisthesameasthequeryname.Thedefaultvalueforthestoragetypeisinternal.Ifyouwanttosavethequeryexternally,youmustspecifyafilenameforit.

SaveOptions

1 Keepreferenceinquerylibrary.

2 Savelistofactivedrawings.

4 Savelocationcoordinates.

8 Savecurrentpropertyalterationdefinition.

16 Executeautomatically.

AquerygetsanameandanIDonlyifitisreferencedthequerylibrary.AnewquerythatyouhavenotyetsaveddoesnothaveanameoranID,andneitherdoesanexternalqueryunlessyoukeepareferencetoitinthequerylibrary.

Thefollowingexamplesavesthecurrentquerytothequerylibrarywithoutsavingittoafile.

(ade_qrysave"CATEGORY1"'(("name"."QUERY1")("saveoption".2)))

TheexpressionsavesthequeryinCATEGORY1andnamesitQUERY1.Becausethereisno"qtype"listelement,itsavesthequeryinternallybydefault,

Page 280: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

whicheliminatestheneedfora"filename"element.

Thefollowingexamplesavesthecurrentquerytothequerylibraryandalsotoafile.

(ade_qrysave"CATEGORY1"'(("name"."QUERY1")("description"."Query1description")("qtype".2)("filename"."c:\\qryfiles\\Query1.qry")("saveoption".3)))

Page 281: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrysetaltpropQueryFunctions

Turnspropertyalterationonoroff.

(ade_qrysetaltpropflag)

ReturnsTornil.

flag Specifieswhetherpropertyalterationisonoroff:T=on,nil=off.

Thisfunctionaffectsthecurrentquery.

Ifthereisnocurrentpropertyalterationdefinition,thisfunctionhasnoeffect.Tocreateapropertyalterationdefinition,useade_altpdefine.

Page 282: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrysetreptransformQueryFunctions

Enablesordisablestransformationforthecurrentreportquery.

(ade_qrysetreptransformflag)

ReturnsTifsuccessful,otherwisenil.

flag Tornil,whereT=transformationenabled,andnil=transformationdisabled.

Thefunctionreturnsnilifthereisnoreportquerytemplate.

Page 283: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qrysettypeQueryFunctions

Setsthequerymode:Preview,Draw,orReport.

(ade_qrysettypeqrytype[multilinetemplfilename])

ReturnsTornil.

qrytype Querymode(string):"preview","draw",or"report",where"preview"=Displayqueriedobjectswithoutretrievingthem,similartoQuickView,"draw"=Getqueriedobjectsfromsourcedrawingsorexternaldatabasesandcopytotheprojectdrawing,and"report"=Directqueriedinformationtoanoutputfile.

multiline Whethertowritereportrowsforsub-objects:Tornil,whereT=Writereportrowsforsub-objects(objectssuchasverticesofpolylinesandattributesofblocks),andnil=Writelinesfortop-levelobjectsonly.Relevantonlyifqrytypeis"report".

templ> Orderedlistofobjectpropertiestoreport(string).Eachlistelementdefinesareportcolumn.Forexample,".type,.layer".Relevantonlyifqrytypeis"report".

filename Pathandfilenameoftheoutputfile(string).Relevantonlyifqrytypeis"report".

Thisfunctionaffectsthecurrentquery.

Page 284: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thethreeoptionalparameters,multiline,templ,andfilename,arerelevantonlyifthequerymodeis"report".Ifthequerymodeis"preview"or"draw",omitthem.

ThefollowingexamplesetsthequerymodetoReport.

(ade_qrysettype"report"T".type,.layer""output.txt")

Page 285: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_qryungroupQueryFunctions

Ungroupsasequenceoftwoormorequeryconditions.

(ade_qryungroupcondition_id1condition_id2)

ReturnsTornil.

condition_id1 ConditionIDofthefirstgroupedcondition(real).

condition_id2 ConditionIDofthelastgroupedcondition(real).

Thisfunctionaffectsthecurrentquery.

Aquerydefinitionconsistsofasequenceofqueryconditions.Withinsuchasequence,therecanbesubsequencesthathavebeengroupedbyenclosingtheminparentheses.Suchgroupsmayhavebeenestablishedwhenthequerywasfirstdefined.Seethebggroupsandendgroupsparametersofade_qrydefine.Ortheymayhavebeenestablishedafterwardbyade_qrygroup.Howeverestablished,youcanuseade_qryungrouptoundoagroup(removeitsenclosingparentheses).

Whenyoucallade_qryungroup,theconditionyouspecifyasthefirstofthegroup(condition_id1)mustbeapredecessortotheoneyouspecifyasthelast(condition_id2).Thefunctionungroupsthefirstandthelastandanyconditionsinbetween.Forexample,considerthefollowingquerydefinition,whichiscomposedofconditionsA,B,C,andD:

Page 286: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AAND(BORCORD)

Thefunctioncall(ade_qryungroupIDofBIDofD)changesthequerydefinitionto

AANDBORCORD

Page 287: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_rtdefrangeRangeTableFunctions

Definesarangetable.

(ade_rtdefrangetabnamedescriptionrange_defn)

ReturnsarangetableIDornil.

tabname Rangetablename(string);canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

description Rangetabledescription(string)

range_defn Rangetabledefinition(string)

Arangetableallowsyoutoalterpropertiesofqueriedentitiesconditionally.Itcontainsasetofpropertyalterationvaluesfromwhichasinglevalueisselecteddependingonconditionsobtaininginthequeriedentitytobealtered.

Therange_defnargumentisarangetabledefinition,alistofrangeexpressions.Eachrangeexpressionincludes(1)aconditionand(2)apropertyalterationvaluetoreturniftheconditionistrue.Thisinformationisexpressedasalistofthreeelements:arangetableoperatorandacomparisonvalue(whichtogethermakeupthecondition),andthereturnvalue.Youmuststateeachvalueexplicitly.Youcannotsubstituteanexpression.

SeeUsingaRangeTableformoreinformation.

Page 288: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_rtdeltableRangeTableFunctions

Deletesarangetable.

(ade_rtdeltabletablename)

ReturnsTornil.

tablename Rangetablename(string);canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Page 289: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_rtgetidRangeTableFunctions

GetsarangetableID.

(ade_rtgetidtablename)

ReturnsarangetableIDornil.

tablename Rangetablename(string);canbeupto31characterslong.Mustbeunique,containnospaces,andstartwithanalphanumericcharacter

Page 290: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_rtgetpropRangeTableFunctions

Getsthevalueofarangetableproperty.

(ade_rtgetproprt_idproperty)

Returnsapropertyvalue,orlist,ornil.

rt_id RangetableID(real)

property Propertytogetthevalueof(string).SeetheRangeTablePropertiestablebelow.

RangeTableProperties

name Rangetablename(string)

description Rangetabledescription(string)

expr Rangetabledefinition(listofrangeexpressions)

Seeade_rtdefrangeforinformationaboutsettingrangetableproperties.

Page 291: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_rtlistRangeTableFunctions

ListstheIDsofallrangetablesdefinedintheproject.

(ade_rtlist)

ReturnsalistofrangetableIDsornil.

Page 292: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_saveobjsObjectSavingFunctions

Savesobjectsqueuedforsavingbacktothesourcedrawings.

(ade_saveobjspriorities)

ReturnsTornil.

priorities Listcontainingonetofoursavebackoperationcodes,dependingonthenumberofsavebackoperationsyouarespecifying(integer).Listthecodesinorderoftheirrelativepriority.SeetheSave-BackOperationCodestablebelow.

Save-BackOperationCodes

Code Operation Description

1 CameFrom Savesobjectstotheirsourcedrawings

2 Selective Savesobjectsyouselecttothedrawingsyouspecify

3 Layer Savesobjectstolayersinthesourcedrawingsthatusethesamenamesasthoseinwhichtheobjectslie

4 Area Savesobjectstothesourcedrawingwithinwhoseextentstheylie,evenifonlypartiallywithin

Duringthesavebackoperation,theoptionsareexecutedintheorderspecifiedintheprioritieslist.Thelistmustcontainatleastoneoption.Forexample:

Page 293: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_saveobjs2143)

Tosaveaselectionsettoaspecificdrawing,useade_savetodwg.

Page 294: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_savetodwgObjectSavingFunctions

Savesaselectionsettoaspecificdrawing.

(ade_savetodwgsel_setdwg_id)

ReturnsTornil.

sel_set Selectionsetname.

dwg_id DrawingIDofthedestinationdrawing(real)

Tosaveobjectsqueuedforsavingbacktothesourcedrawings,useade_saveobjs.

Page 295: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_sqlgetenvstringSQLEnvironmentFunctions

GetsastringdescribingtheSQLenvironment.

(ade_sqlgetenvstringlinktemplate)

ReturnsastringdescribingtheSQLenvironmentornil.

linktemplate Linktemplate(string)

Thisfunctionreturnsastringwiththefollowinginformation:

"DBname.Catalog.Schema.Table"

FormoreinformationaboutlinktemplatesusingSQL,seetheAutoCADonlinedocumentation.

Page 296: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_ssfree

Releasesaselectionset.

(ade_ssfreess)

ReturnsTornil.

ss Selectionsettorelease.

SelectionsetsarereturnedbyanumberofVisualLISPfunctions.SeeFunctionsThatReturnSelectionSets.Itisimportanttoreleaseselectionsetsasyoufinishwiththem,becausethenumberallowedislimited.Ifthenumberrunsout,yourapplicationwillfail.

Thefollowingexampleallocatesaselectionsetandthenreleasesit.

(setqss(map_dwgBreakObjsscutboundaryskiptopokeepod))

···

(setqstatus(ade_ssfreess))

Page 297: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_usergetUserSecurityFunctions

Getstheloginnameorentitylocknameofthelocaluser.

(ade_userget[for_entity_locks])

Returnsausername(string)ornil.

for_entity_locks Whattodoifthelocaluserisnotloggedintotheapplication(optional):Tornil,whereT=Gettheusernameusedtoidentifytheownerofobjectlockssetlocally,andnil=Returnnil.Omittingthisargumentisthesameassupplyingnil.

Ausernamecanhaveasmanyas32characters.

Ifthelocaluserisloggedintotheapplication,theuser'sapplicationloginnameisusedtoidentifytheownerofobjectlockssetlocally.Ifthelocaluserisnotloggedintotheapplication,theuser'soperatingsystemloginnameisused.

Thisfunctionhelpsyoudetermineiftheownerofaparticularobjectlockisthelocaluser.

Page 298: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_usergetrightsUserSecurityFunctions

Getstheaccessrightsofauser.

(ade_usergetrights[username])

Returnsabitcodefortherightsallowed.SeetheUserRightsCodestablebelow.

username Loginname(string),atmost32characters.

Iftheusernameargumentisomittedornil,thefunctionreturnstherightsofthecurrentuser.

UserRightsCodes

Code UserRights

1 Superuser(inwhichcasetheotherbitsdon'tmatter).

2 Permissiontoalterthedrawingset.

4 Permissiontoeditobjects.

8 Permissiontoexecuteadrawquery.

16 PermissiontoeditFeatureClassdefinition.

Iftheusernameargumentisomittedornil,andthereisnocurrentuser,thefunctionreturnsabitcodewithallbitsset,becausetheno-current-usercondition

Page 299: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ispossibleonlyifthesystemoption"ForceUserLogin"issettonil,inwhichcaseallusershaveallrightsexceptthosereservedforasuperuser.

Onlyasuperusercanspecifyaloginnameotherthantheirown.Iftheusernameargumentisnottheloginnameofthecurrentuser,andthecurrentuserdoesnothavesuperuserrights,thefunctionreturnsnil,andthemessage"Accessisdenied"isaddedtotheerrorstack.

Page 300: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_userlistUserSecurityFunctions

Liststhecurrentusers.

(ade_userlist)

Returnsalistofuserloginnamesornil.

Page 301: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_usersetUserSecurityFunctions

Logsinauser.

(ade_userset[username[password]])

ReturnsTiftheuserisloggedinsuccessfully,otherwisenil.

username Loginname(string).

password Password(string).

Ifeitherargumentisomitted,theUserLogindialogboxdisplays.Ifaloginnamewasspecified,itappearsinthedialog'sLoginNamefield.

Ifbothargumentsarespecified,buttheusercannotbeloggedin,oneofthefollowingmessagesisaddedtotheerrorstack:

Invalidusername.Invalidpassword.

Ifthedrawingsetincludesactivedrawingscontaininglockedentities,thecurrentusercannotbechanged.Ifyouattempttologinadifferentuserunderthoseconditions,thefollowingerrormessageisaddedtotheerrormessagestack:

Cannotloginagainwhendrawingsarelocked/active.

Page 302: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_usersetrightsUserSecurityFunctions

Setstheaccessrightsforauser.

(ade_usersetrightsusernameuserrights)

ReturnsTonsuccess,otherwisenil.

username Loginname(string)

userrights Abitcodefortherightstoallow.SeetheUserRightsCodestablebelow.

UserRightsCodes

Code UserRights

1 Superuser(inwhichcasetheotherbitsdon'tmatter).

2 Permissiontoalterthedrawingset.

4 Permissiontoeditobjects.

8 Permissiontoexecuteadrawquery.

16 PermissiontoeditFeatureClassdefinition.

Thisfunctioncannotexecuteunlessthecurrentuserhassuperuserrights,anditcannotchangetherightsofthecurrentuserinanycase.Ifanordinaryuserisloggedinwhenthisfunctioniscalled,orasuperuserisloggedinandthe

Page 303: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

functioncallwouldchangetherightsofthecurrentuser,thefunctionreturnsnil,andthefollowingmessageisaddedtotheerrormessagestack:

Can'tchangerightsofthecurrentuser.

Page 304: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ade_version

GetstheversionnumberoftheDataExtensionprogramminginterface.

(ade_version)

Returnsaversionnumber(string)ornil.

Atruntime,thisfunctionreturnstheversionnumberoftheDataExtension(ADE)programminginterfacewithwhichyourapplicationiscommunicating.Forexample("2.024").

Page 305: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CoordinateTransformationFunctions

Thecoordinatetransformationfunctionsbeginwithade_proj.

ade_projgetctgyname

Identifiesthecategorythatacoordinatesystembelongsto.

ade_projgetinfo

Getsinformationaboutaprojectionsystem.

ade_projgetwscode

Getstheprojectdrawing'scoordinatesystemcode.

ade_projlistctgy

Listsavailablecoordinatesystemcategories.

ade_projlistcrdsysts

Listsavailablecoordinatesystemsinagivencategory.

ade_projptbackward

Page 306: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Computesnewcoordinatesforasourcepoint.

ade_projptforward

Computesnewcoordinatesforadestinationpoint.

ade_projsetdest

Setsthedestinationcoordinatesystem.

ade_projsetsrc

Setsthesourcecoordinatesystem.

ade_projsetwscode

Setstheprojectdrawing'scoordinatesystem.

Page 307: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DrawingFunctions

Thefunctionsfordrawingmanagementbeginwithade_dwg.

ade_dwgactivate

Activatesadrawing.

ade_dwgactualpath

Returnsthefullpathofadrawing.

ade_dwgaliaspath

Returnsthealiaspathofadrawing.

ade_dwgattriblist

Returnsalistofattributetagsforthespecifiedblockname.

ade_dwgdeactivate

Deactivatesadrawing.

ade_dwggetid

Page 308: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

GetsthedrawingIDofadrawing.

ade_dwggetsetting

Getsadrawingsettingvalue.

ade_dwghaslocks

Checksifadrawinghaslockedobjects.

ade_dwgindex

Appliesspecifiedindexoperationstoadrawing.

ade_dwgindexdef

Specifieswhichindexesaretobecreatedorremoved.

ade_dwgisactive

Checksifadrawingisactive.

ade_dwgistoplevel

Checksifadrawingisdirectlyattachedtotheprojectdrawing.

ade_dwgproplist

Listsallvaluesfoundinadrawingforagivendrawingproperty.

ade_dwgquickview

Page 309: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Displaysaquickviewofadrawing.

ade_dwgselectdlg

DisplaystheSelectDrawingsdialogbox.

ade_dwgsetof

Identifiesthedrawingstowhichagivendrawingisattached.

ade_dwgsetsetting

Setsadrawingsettingvalue.

ade_dwgunlock

Removesallobjectlocksfromadrawing.

ade_dwgzoomextents

Zoomstotheextentsoftheactivedrawings.

Page 310: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DrawingSetFunctions

Thefunctionsfordrawingsetmanagementbeginwithade_ds.

ade_dsattach

Attachesadrawingtotheproject.

ade_dsdetach

Detachesadrawingfromtheproject.

ade_dsisnested

Checksifadrawinghasnesteddrawings.

ade_dslist

Liststhedrawingsattachedtoagivendrawing.

ade_dsproplist

Listsallvaluesfoundinthedrawingsetforagivendrawingproperty.

Page 311: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

DriveAliasFunctions

Thedrivealiasfunctionsbeginwithade_alias.

ade_aliasadd

Createsadrivealias.

ade_aliasdelete

Deletesadrivealias.

ade_aliasgetlist

Listsalldrivealiasesintheproject.

ade_aliasupdate

Assignsanewdriveandpathtoadrivealias.

Page 312: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ErrorMessageFunctions

Thefunctionsforhandlingerrormessagesbeginwithade_err.

ade_errclear

Clearstheerrorstack.

ade_errcode

Getstheerrorcodeforaspecificerrorontheerrorstack.

ade_errgetlevel

Getsthesystemerrorlevel.

ade_errmsg

Getstheerrormessageforaspecificerrorontheerrorstack.

ade_errpush

Pushesanerrormessagetothestack.

ade_errpushstatement

Page 313: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Pushesastatementtothestack.

ade_errqty

Returnsthenumberoferrormessagesonthestack.

ade_errsetlevel

Setsthesystemerrorlevel.

ade_errshowdlg

DisplaystheMapMessagesdialogbox,whichshowsalistoferrormessagesonthestack.

ade_errstatement

Getstheerroneousstatementforaspecificerroronthestack.

ade_errtype

Getsthetypeofaspecificerrorinthestack.

Page 314: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ExpressionEvaluationFunction

Theexpressionevaluationfunctionbeginswithade_exp.

ade_expreval

EvaluatesanAutoCADMapexpression.

Page 315: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ObjectDataFunctions

Thefunctionsforobjectdatamanagementbeginwithade_od.

ade_odaddfield

Addsfieldstoatable.

ade_odaddrecord

Attachesdatatoanobject.

ade_odattachrecord

Attachesanewrecordtoanobject.

ade_oddefinetab

Createsanobjectdatatable.

ade_oddeletefield

Deletesfieldsfromatable.

ade_oddeletetab

Page 316: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Deletesatable.

ade_oddelrecord

Deletesarecord.

ade_odfreerec

Freesthememoryclaimedindefininganewrecord.

ade_odgetfield

Getsafieldvalue.

ade_odgetrecfield

GetsafieldvalueusingarecordID.

ade_odgetrecord

GetsarecordID.

ade_odgettables

Liststhetablesattachedtoanobject.

ade_odmodifyfield

Modifiesfieldpropertiesinatable.

ade_odmodifytab

Page 317: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Redefinesatable.

ade_odnewrecord

Definesanewobjectdatarecord.

ade_odpresetfield

Assignsavaluetoafieldinanewrecord.

ade_odrecordqty

Countstherecordsattachedtoanobject.

ade_odsetfield

Setsafieldvalue.

ade_odtabledefn

Getsatabledefinition.

ade_odtablelist

Liststhetablesintheproject.

Page 318: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ObjectEditingFunctions

Thefunctionsforobjecteditingbeginwithade_edit.

ade_editdefcen

Definesanewlabelpointforanobject.

ade_editlockederased

Getstheobjectsinthesavesetthathavebeenerased.

ade_editislocked

Getslockinformationaboutanobjectifitislocked.

ade_editlocked

Getstheobjectsinthesavesetthathavebeenmodified.

ade_editlockobjs

Locksasetofobjectsandaddsthemtothesaveset.

ade_editnew

Page 319: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Getstheobjectsinthesavesetthatarenew.

editunlockobjs

Unlocksasetofobjectsandremovesthemfromthesaveset.

Page 320: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ObjectSavingFunctions

Theobjectsavingfunctionsbeginwithade_save.

ade_saveobjs

Savesobjectsqueuedforsavingbacktothesourcedrawings.

ade_savetodwg

Savesaselectionsettoaspecificdrawing.

Page 321: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

OptionFunctions

Theoptionfunctionsbeginwithade_pref.

ade_prefgetval

Getsanoptionsetting.

ade_prefsetval

Setsanoption.

Page 322: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PropertyAlterationFunctions

Thefunctionsforspecifyinghowobjectsretrievedinaqueryshouldbealteredbeginwithade_altp.

ade_altpclear

Clearsthecurrentpropertyalterationdefinition.

ade_altpdefine

Createsapropertyalterationexpression.

ade_altpdelprop

Deletesapropertyalterationexpression.

ade_altpgetprop

Getsapropertyalterationexpression.

ade_altplist

ListstheIDsofthecurrentpropertyalterationexpressions.

ade_altpsetprop

Page 323: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Modifiesapropertyalterationexpression.

Page 324: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

QueryFunctions

Thefunctionsforquerymanagementbeginwithade_qry.

ade_qryclear

Clearsthecurrentquery.

ade_qrydefine

Definesaquery.

ade_qryexecute

Executesthecurrentquery.

ade_qrygetcond

Getsaquerycondition.

ade_qrygetdwgandhandle

GetsthesourcedrawingIDandoriginalhandleofaqueriedobject.

ade_qrygetentlist

Page 325: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Returnsentityhandlesforobjectsthatsatisfythecurrentquery.

ade_qrygetreptransform

Checkswhethertransformationisenabledforthecurrentreportquery.

ade_qrygroup

Groupsqueryconditions.

ade_qryhandent

Getstheentitynameforthespecifiedhandle.

ade_qrylist

ListstheIDsofthecurrentqueryconditions.

ade_qrysave

Savesthecurrentquery.

ade_qrysetaltprop

Turnspropertyalterationonoroff.

ade_qrysetcond

Modifiesaquerycondition.

ade_qrysetreptransform

Page 326: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Enablesordisablestransformationforthecurrentreportquery.

ade_qrysettype

Setsthequerymode:Preview,Draw,orReport.

ade_qryungroup

Ungroupsqueryconditions.

Page 327: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

QueryLibraryFunctions

Thefunctionsforquerylibrarymanagementbeginwithade_ql.

ade_qldelctgy

Deletesaquerylibrarycategory.

ade_qldelquery

Deletesaqueryfromthequerylibrary.

ade_qlgetctgyinfo

Getsinformationaboutaquerycategory.

ade_qlgetqryinfo

Getsinformationaboutaquery.

ade_qllistctgy

ListsthequerycategoryIDs.

ade_qlloadqry

Page 328: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Makesasavedquerycurrent.

ade_qlqrygetid

GetsaqueryID.

ade_qlsetctgyname

Changesaquerycategoryname.

ade_qlsetquery

Changesaqueryname,description,orthecategoryitbelongsto.

Page 329: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

RangeTableFunctions

Thefunctionsforrangetablemanagementbeginwithade_rt.

ade_rtdefrange

Definesarangetable.

ade_rtdeltable

Deletesarangetable.

ade_rtgetid

GetsarangetableID.

ade_rtgetprop

Getsthevalueofarangetableproperty.

ade_rtlist

ListstheIDsofallrangetablesdefinedintheproject.

Page 330: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

SQLEnvironmentFunctions

TheSQLenvironmentfunctionsbeginswithade_sqlorade_key.

ade_keycolumnlist

Returnsalistofthekeycolumnnamesforthespecifiedlinkpathname.

ade_sqlgetenvstring

GetsastringdescribingtheSQLenvironment.

Page 331: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TextLabelFunction

Thetextlabelfunctionbeginswithade_ent.

ade_entsetlocation

Setsanewentitylabelpoint.

Page 332: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

UserSecurityFunctions

Theusersecurityfunctionsbeginwithade_user.

ade_userget

Getstheloginnameorentitylocknameofthelocaluser.

ade_usergetrights

Getstheaccessrightsofthespecifieduser.

ade_userlist

Liststhecurrentusers.

ade_userset

Logsinauser.

ade_usersetrights

Setstheaccessrightsforthespecifieduser.

Page 333: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

OtherFunctions

Miscellaneousade_xxfunctions.

ade_entsetlocation

Setsanewentitylabelpoint.

ade_expreval

EvaluatesanAutoCADMapexpression.

ade_ssfree

Releasesaselectionset.

ade_osfexpand

Searchesadirectoryandreturnsalistoffilenames.

ade_version

GetstheversionnumberoftheDataExtensionprogramminginterface.

Page 334: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_dwgbreakobjMapToolFunctions

Breakslinearobjectswheretheycrossboundaries.

(map_dwgbreakobjsscutboundaryskiptopokeepod)

Returnsaselectionsetofobjectscutbytheoperationornil.

sscut Selectionsetofobjectstocut.

boundary Objectnameofasingleobjectoraselectionsetofmultipleobjects.Validobjects:line,polyline,circle,arc

skiptopo Skipflag:1Skipobjectsreferencedbyatopology0Trimobjectsreferencedbyatopology

keepod Keepflagthatsetswhethertokeepobjectdataofclippedobjectsinresultobject:1Retainallobjectdataonanyclippedobject0Dropobjectdataonanyclippedobject

Thisfunctioncutslinearobjects,suchaslines,polylines,circles,andarcs,thatcrosstheselectedboundary.Unlikethemap_dwgtrimobjfunction,thisfunctiondoesnotdeletethepartsoftheobjectoneithersideoftheboundary.Forexample,youcouldmarkaboundaryanddivideonemapintotwosectionmapsalongthisboundary.

Thefollowingexamplepromptsyoutoselectanobjecttobreakandmake

Page 335: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

choicesaboutthebreakoperation.Itincludeserrorreporting.

(prompt"\nSelectobjecttobreak:")(setqsscut(ssget))(ifsscut(progn(setqboundary(car(entsel"\nSelectboundaryobject")))(ifboundary(progn(initget"YesNo")(setqkword(getkword"\nSkipobjectsreferencedbyatopologyYes/No<Yes>:"))(if(or(nullkword)(=kword"Yes"))(setqskiptopo1)(setqskiptopo0))(initget"YesNo")(setqkword(getkword"\nRetainobjectdataYes/No<Yes>:"))(if(or(nullkword)(=kword"Yes"))(setqkeepod1)(setqkeepod0))(setqresult(map_dwgbreakobjsscutboundaryskiptopokeepod))(ifresult(prompt"\nObject(s)breaksuccessfully.")(progn(setqnberr(ade_errqty)i0)(repeatnberr(prompt(strcat"\nError"(rtosi20)"of"

Page 336: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(rtosnb20)":"(ade_errmsgi)))(setqi(1+i)))))))))

Page 337: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_dwgtrimobjMapToolFunctions

Trimslinearobjectsinsideoroutsideofaspecifiedboundary.

(map_dwgtrimobjssclipboundaryinoroutskiptopokeepodbitflag)

Returnsaselectionsetofobjectstrimmedbytheoperationornil.

ssclip Selectionsetofobjectstotrim.

boundary Entitynameofaboundaryobject.Validobjects:asinglecircleorasingleclosed2Dpolyline

inorout Trimflag:1Trimoutsideboundary0Triminsideboundary

skiptopo Skipflag:1Skipobjectsreferencedbyatopology0Trimobjectsreferencedbyatopology

keepod Keepflagthatsetswhethertokeepobjectdataoftrimmedobjectsinresultobject:1Dropobjectdatafromalltrimmedobjects0Retainobjectdataonalltrimmedobjects

bitflag Bitflagthatsetsthewaytohandleobjectsthatcannotbetrimmed:0Deletetheseobjectswithinorontrimboundary1Ignoretheseobjectswithinorontrimboundary

Page 338: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

2Referencetheinsertionpointofanyoftheseobjectswithinorontrimboundary

Page 339: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltblkattsPlottingFunctions

Getsalistofblockattributes.

(map_pltblkattsname)

Returnsalistofattributesornil.

name Layoutblockname(string)

Page 340: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltblklistPlottingFunctions

Getsalistofvalidplotlayoutsforthecurrentworksession.

(map_pltblklist)

Returnsthenamesoftheblocksinalistornil.

Thisfunctionreturnstheplotlayout(block)namesthatareusableasplotlayouts.Toqualify,ablockmusthaveatleastoneuniqueviewportononeofitslayers.Thatis,iftheblockhasmorethanoneviewport,itmusthaveonelayerthatcontainsonlyoneviewport.

Theuniqueviewportcanshareitslayerwithobjectsofothertypes,suchaslines,polylines,blocks,andtext.

Page 341: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltblkvpsPlottingFunctions

Returnsalistofvalidviewportlayersinaspecifiedlayoutblocks.

(map_pltblkvpsname)

Returnsalistofthevalidviewportlayersorniliftheblocknameorlayoutblockisinvalid.

name Layoutblockname(string)

Page 342: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcleanupPlottingFunctions

Restoressettingsalteredbymap_pltinit.

(map_pltcleanup)

ReturnsTornil.

Thisfunctionrestorescertainsettingstothestatetheywereinbeforemap_pltinitwascalled.Seemap_pltInitforalistofaffectedsettings.Beforeyoucanuseotherplotfunctions,youmustcallmap_pltinitagain.

Page 343: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcurrdefPlottingFunctions

Selectsorcreatesaplotset.

(map_pltcurrdefname)

ReturnsTornil.

name Nameoftheplotset(string)

Ifaplotsetcallednamedoesnotexistinthecurrentworksessionorifthefunctionmap_pltdefreadwasnotcalled,thisfunctioncreatesanewplotsetcalledname.

Usemap_pltcurrsettodefinetheattributesoftheplotset.

Iftheplotsetnameexistsandthefunctionmap_pltdefreadwascalled,thisfunctionloadsacopyofnameintomemory.Usemap_pltcurrGetandmap_pltcurrSettoexamineorchangeitsattributes.

NoteOnlyoneplotsetcanbecurrent.

Page 344: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcurrdelPlottingFunctions

Resetsaplotsetattributetoitsdefaultvalue.

(map_pltcurrdelattr)

ReturnsTornil.

attr Nameoftheattributetoreset(string)

Page 345: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcurrgetPlottingFunctions

Getsanattributevalueforthecurrentplotset.

(map_pltcurrgetattr)

Returnsthevalueofthespecifiedattributeornil.

attr Nameoftheplotsetattributetoretrieve(string)

Thisfunctionretrievesthevalueofaspecificattributeforthecurrentplotset.Thedatatypeofthereturnvaluedependsupontheattribute.Tosetplotsetattributes,usemap_pltdefget.

Page 346: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcurrsavePlottingFunctions

Appendsthecurrentplotsetdefinitiontotheplotsetlist.

(map_pltcurrsave)

ReturnsTornil.

Thisfunctionappendsthecurrentplotsetdefinitiontotheplotsetlistofthecurrentworksession.Thislistisnotsavedintheworksessionuntiltheuserexecutesasavewithacalltomap_pltdefsave.

Toeditandsaveaplotsetdefinition

1. Gettheplotsetdefinitionwithmap_pltdefreadandmap_pltcurrdef.2. Makethenecessarychanges.

3. Savethedefinitioninthelistwithmap_pltcurrsave.4. Savethelistinthecurrentworksessionwithmap_pltdefsave.5. Savetheworksession.

Ifyoudonotsavebeforetheendoftheprocessing,anotherapplicationcanoverwriteyourchangeswithacalltomap_pltcurrdef.

Page 347: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltcurrsetPlottingFunctions

Setsthevalueofanattributeforthecurrentplotset.

(map_pltcurrsetattrvalue)

ReturnsTornil.

attr Nameoftheplotattributetoset(string)

value Valuefortheplotsetattribute(typevaries)

Thisfunctionsetsthevalueofthespecifiedattribute.Thevaluedatatypedependsupontheattribute.Tosetplotattributes,usemap_pltdefget.

Page 348: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefdeletePlottingFunctions

Deletesaplotsetdefinition.

(map_pltdefdeletename)

ReturnsTornil.

name Plotsetname(string)

Thefunctionupdatestheplotdefinitiondictionaryinthecurrentworksession.

Page 349: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefgetPlottingFunctions

Getsthevalueofanattributeoftheplotsetdefinition.

(map_pltdefgetnameattr)

Returnsthevalueofthespecifiedattributeornil.

name Plotsetname(string)

attr Nameoftheplotsetattributetoretrieve(string).

Togetthevalueofanattributeforthecurrentplotset,usemap_pltCurrGet.

Thedatatypeofthereturnvaluedependsontheattribute.

Page 350: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdeflistPlottingFunctions

Getsthenamesofavailableplotsetdefinitions.

(map_pltdeflist)

Returnsalistofplotsetnamesornilifnoplotsetsareavailable.

Thisfunctionreturnstheavailableplotsetdefinitions(strings)intheplotdefinitiondictionaryinthecurrentworksession.

Beforeusingthisfunction,youmustcallmap_pltdefread.

Page 351: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefreadPlottingFunctions

Readsinaplotsetdefinition.

(map_pltdefread)

ReturnsTifplotsetdefinitionsareavailabletoreadornil.

Thisfunctionprovidesaccesstoplotsetsintheplotdefinitiondictionaryforthecurrentworksession.

WarningIfyoudonotcallmap_pltdefsave,anewcalltomap_pltdefreadwilleraseyournewplotsetdefinitionoryourchangestoanexistingplotset.

Page 352: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefsavePlottingFunctions

Writesthecurrentplotsetdefinitiontotheplotdefinitiondictionary.

(map_pltdefsave)

ReturnsTifplotsetdefinitionsareavailabletosaveornil.

Thisfunctionstorestheplotsetdefinitionlistinthecurrentworksession.

Ifyoudonotcallthisfunction,anewcalltomap_pltdefreadwilleraseyournewplotsetdefinitionoryourchangestoanexistingplotset.

Page 353: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefvalidPlottingFunctions

Performsacursorycheckofthevalidityofaplotset.

(map_pltdefvalidname)

ReturnsTornil.

name Nameoftheplotset(string)

Thefunctionperformsacursorycheckofthegivenplotsettoseeifallrequiredattributeshavebeenset.Itdoesnotattachandquerytheboundarydrawing.Whenusedwithinadialogbox,thiscallcanquicklycheckonaplotset'susability.

Ifthecheckfails,youcanusedataextensionerrormessagefunctions(ade_err[xx])toretrieveerrorsfromtheerrorstack.

Toperformanextensivecheck,usethemap_pltdefverifyfunction.

Page 354: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdefverifyPlottingFunctions

Performsanextensivecheckofthevalidityofaplotset.

(map_pltdefverifyname)

ReturnsTiftheplotsetisvalidornil.

name Nameoftheplotset(string)

Thisfunctionmakessurethatnoerrorsoccurwhenplottingtakesplace.Sincethecheckincludesqueryingforallboundaryobjects,itcouldtakesometime.

Toperformacursorycheck,usethemap_pltdefvalidfunction.

Ifthecheckfails,youcanusedataextensionerrormessagefunctions(ade_err[xx])toretrieveerrorsfromtheerrorstack.

Page 355: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltdisplayPlottingFunctions

Generatestheplotdisplayforthespecifiedboundary.

(map_pltdisplaybndryname)

ReturnsTornil.

bndryname Nameforaboundaryobject(string)

Thisfunctionpreparesthedisplaytoplotforthegivenplotsetdefinitionandboundaryobjectname.Generatingtheplotdisplayforthespecifiedboundaryincludes

Switchingtopapermode(ifnecessary)InsertingthelayoutblockMappingboundaryobjectdatatolayoutblockattributes(ifapplicable)Executingthequery(ies)tocollecttheobjectstoplotTrimmingtheobjectstotheboundary(ifapplicable)Displayingtheobjectsintheviewport

Youmustcallmap_pltdisplaybeforeyoucallmap_pltplot.

Page 356: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltexecutePlottingFunctions

Plotstheplotsetforthespecifiedplotsetname.

(map_pltexecutename)

ReturnsTornil.

name Nameofplotsettoexecute(string)

Thisfunctiongeneratesandissuesplotsforeachdefinedboundary.

Togetalistofavailableplotsetnames,usemap_pltdeflist.

Page 357: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltinitPlottingFunctions

Initializesenvironmentforplotting.

(map_pltinit)

ReturnsTalways.

Thisfunctionmustbecalledbeforeanyotherplottingfunctions.Themap_pltinitfunctionmodifiesthefollowingsettingsandchecksthattheplotsetdescriptionfileexists:

AutoCADVariables

Variable Setting

CMDECHO 0

EXPERT 1

AutoCADMapOptions

Option Setting

DontAddObjectsToSaveSet T

ActivateDwgsOnAttach T

MkSelSetWithQryObj T

Page 358: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Torestorethesesettingstotheiroriginalvalues,usemap_pltcleanup.Beforeyoucanuseotherplotfunctions,youmustcallmap_pltinitagain.

Seeade_prefgetvalforacompletelistofAutoCADMapoptions.

Page 359: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltplotPlottingFunctions

Executesthecurrentplotscript.

(map_pltplot)

ReturnsTornil.

Thefunctionplotsthecurrentscreendisplay.LiketheAutoCADPLOTcommand,itexecutestheplotscriptofthescreendisplay'splotsetdefinition.

Youmustcallmap_pltdisplaybeforeyoucallthisfunction.

Page 360: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_pltrestorePlottingFunctions

Restoresdisplayalteredbymap_pltdisplay.

(map_pltrestore)

ReturnsTornil.

Page 361: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_topoauditMapTopologyFunctions

Checkswhetheratopologyiscorrect.

(map_topoaudittpm_id)

ReturnsTornil.

tpm_id UniqueIDforatopology(real).TopologymustbeopenforRead

Thefunctionauditsthegeometryofatopologytodeterminewhetherthegeometricalrelationshipsdefinedbythetopologyobjectdataarecorrect.Itshowsthelocationoferrors.

Thefollowingexamplechecksatopologynamed"parcels"andprovideserrorreporting.

(setqtpm_id(tpm_acopen"parcels"))(iftpm_id(progn(setqresult(map_topoAudittpm_id))(tpm_acclosetpm_id)))

(if(nullresult)(progn(setqi0nberr(ade_errqty))(repeatnberr(prompt

Page 362: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(strcat"\nError"(rtosi20)"of"(rtosnberr20)":"(ade_errmsgi)))(setqi(1+i)))))

Page 363: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_topocloseMapTopologyFunctions

Convertsallpolygonsinatopologytoclosedpolylines.

(map_topoclosetoponamelayergroupodataaselink)

Returnsaselectionsetofclosedpolylinescreatedbythefunction.

toponame Uniquenameforatopology(string).Topologymustbeclosed.

layer Targetlayerforclosedpolylines(string).Iflayernameisincorrect(forexample"@@"),polylinesarecreatedinthecurrentlayer

group Groupflagforcomplexpolygons:1or01groupcomplexpolygons0donotgroupcomplexpolygons

odata Objectdataflagthatsetswhethertocopyobjectdataonthepolygoncentroidtotheresultingpolyline:1or01copyobjectdataonthecentroid0ignoreobjectdataonthecentroid

aselink ASElinkflagthatsetswhethertocopyASElinkdataonthecentroidtotheresultingpolyline:1or01copyASElinkdataonthecentroid0ignoreASElinkdataonthecentroid

Page 364: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_topocompleteMapTopologyFunctions

Completesallobjectsinaloadedpartialtopology.

(map_topocompletetoponame)

Returnsaselectionsetofallobjectsretrievedtocompletethetopology.

toponame Uniquenameforatopology(string).Topologymustbeclosed.

Thisfunctionperformsaquerytoretrieveobjectsintotheworksession.Thetpm_infocompletefunctiondetermineswhetherthetopologyiscompletelyrepresentedintheworksession.

Thisfunctioncanonlycompleteobjectsimportedfromanexistingsourcedrawing.Forapolygontopology,thisfunctionimportslinks,nodes,andacentroid,ifitismissing,fromthesourcedrawing.Foranetworktopology,thisfunctionimportslinksandnodes.Foranetworktopology,itimportsonlynodes.

Page 365: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

map_topostatMapTopologyFunctions

Getsstatisticsforatopology.

(map_topostattpm_id)

Returnsalistcontainingthestatisticsforthespecifiedtopology,ornil.

tpm_id UniqueIDforatopology(real).Topologymustbeopenforread

Thisfunctionreturnsalistalistofdottedpairsornil.

Thefollowingdottedpairsapplytoalltopologytypes:

(node_count.#nodes)(link_count.#links)(polygon_count.#polygons)((min_x.#n)(min_y.#n))((max_x.#n)(max_y.#n))

NoteThisfunctionisnotdesignedtocountpolygonsinapartialtopology.Ifthetopologyinquestionispartial,thepolygon_countstatisticmaybeoverstated.Thisisbecausemap_topostatcountsnotonlythepolygonsinthepartialtopology,butalsoanypolygonsthatsharecommonedgeswiththeminthecompletetopology,eveniftheadjacentpolygonsarenotactuallypresentinthecurrentdrawing.

Page 366: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thefollowingdottedpairsapplytonetworktopologies:

(length_total.#n)(length_average.#n)(length_min.#n)(length_max.#n)(length_variance.#n)(length_deviation.#n)

Thefollowingdottedpairsapplytopolygontopologies:

(area_total.#n)(area_average.#n)(area_min.#n)(area_max.#n)(area_variance.#n)(area_deviation.#n)(perimeter_total.#n)(perimeter_average.#n)(perimeter_min.#n)(perimeter_max.#n)(perimeter_variance.#n)(perimeter_deviation.#n)

Page 367: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

BoundaryFunctions

Themapboundaryfunctionsbeginwithmap_dwg.

map_dwgBreakObj

Breaksobjectswheretheycrossboundaryedges.

map_dwgTrimObj

Trimslinearobjectsinsideoroutsideofaspecifiedboundary.

Page 368: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PlottingFunctions

Themapplottingfunctionsbeginwithmap_plt.

map_pltBlkAtts

Getsalistofblockattributes.

map_pltBlkList

Returnsasortedlistofblocknamesthatareusableasplotlayouts.

map_pltBlkVps

Returnsalistofvalidviewportlayersinlayoutblocks.

map_pltCleanup

Restoressettingsalteredbymap_pltInit.

map_pltCurrDef

Selectsorcreatesaplotset.

map_pltCurrDel

Page 369: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Resetsaplotsetattributetoitsdefaultvalue.

map_pltCurrGet

Retrievesthevalueforaspecificattributeforthecurrentplotset.

map_pltCurrSave

Appendsthecurrentplotsetdefinitiontotheplotsetlist.

map_pltCurrSet

Setsthevalueofanattributeforthecurrentplotset.

map_pltDefDelete

Deletesaplotsetdefinition.

map_pltDefGet

Getsthevalueofanattributeoftheplotsetdefinition.

map_pltDefList

Returnsalistofavailableplotsetdefinitionsintheproject.

map_pltDefRead

Readsinaplotsetdefinitionfromtheplotdefinitiondictionaryfortheproject.

map_pltDefSave

Page 370: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Writesthecurrentplotsetdefinitiontotheplotdefinitiondictionary.

map_pltDefValid

Teststheplotsetdefinitionforvalidity.

map_pltDefVerify

Validatesthegivenplotsettopreventplottingerrors.

map_pltDisplay

Generatestheplotdisplayforthespecifiedboundary.

map_pltExecute

Executesaplot,givenaspecifiedplotset.

map_pltInit

Initializesenvironmentforplotting.

map_pltPlot

Executestheplotscriptofthecurrentplotsetdefinition.

map_pltRestore

Restoresdisplayalteredbymap_pltDisplay.

Page 371: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyFunctions

Themaptopologyfunctionsbeginwithmap_topo.

map_topoAudit

Checksthegeometricalrelationshipsdefinedbythetopologyobjectdata.

map_topoClose

Convertsallpolygonsinatopologytoclosedpolylines.

map_topoComplete

Completesallobjectsinaloadedpartialtopology.

map_topoStat

Getsthestatisticsforatopology.

Page 372: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_accloseAccessFunctions

Closesatopology.

(tpm_acclosetpm_id)

ReturnsTornil.

tpm_id TopologyID(real)returnedbytpm_acopen

Whenyoucloseatopology,itremainsinmemoryuntilyouunloadit.

Page 373: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acexistAccessFunctions

Checkswhetheratopologyexists.

(tpm_acexisttoponame[source[loaded]])

ReturnsTifthetopologyexistsornil.

toponame Topologyname(string)

source SourceflagTornil:TChecktopologiesinthecurrentandsourcedrawingsnilCheckthecurrentdrawingonly(default)

loaded LoadedinmemoryflagTornil:TCheckonlytopologiesinmemorynilCheckalltopologies(default)

Page 374: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acloadAccessFunctions

Loadsatopologyintomemory.

(tpm_acloadtoponame[source])

ReturnsTornil.

toponame Topologyname(string)

source SourceflagTornil:TReadfromsourcedrawingsonlynilReadfromcurrentdrawingonly(default)

Beforeloadingatopology,youmustfirsttestforitsexistencewithtpm_acexist.

Topologyinformationisstoredinthedrawing,butthetopologyisnotautomaticallyloadedwhenyouopenthedrawing.Ifyouwant,forexample,toquery,edit,oroverlayatopology,youmustloaditintomemory.Onceloaded,thetopologyremainsinmemoryuntilyouunloadit.

Page 375: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acopenAccessFunctions

Opensatopology.

(tpm_acopentoponame[write_access])

ReturnsthetopologyIDornil.

toponame Topologyname(string)

write_access Accessstatus;Tornil:TWritenilReadonly(default)

Thetpm_acopenfunctionopensatopologyandcreatesanewtpm_idthatprovidesaccesstoit.

Ifyourapplicationopensatopologywithwriteaccess,youruseristheonlyonewhocaneditthistopology.Nootherusercanevenopenit.Ifyourapplicationopenstopologywithreadaccess,otheruserscanopenitalso,butwithreadaccessonly.Tofindouttheaccessstatusofanalready-opentopology,usetpm_infostatus.

Ifyouusetpm_acopentotestthestatusofatopology,alwaysclosethetopologywithtpm_acclosetoensurethatyoudonotleavethetopologyopenwithmultipleIDspointingtoit.

Atopologyloadedfromasourcedrawingcannotbeopenedforwriteaccess.Tofindoutifatopologywasloadedfromacurrentdrawing,use

Page 376: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infocurrent.

ImportantYoumuststorethetopologyIDwhenitisreturnedbytpm_acopen,andmakesurethatyoudonotloseit.IfyoudonothavetheIDofanopentopology,youhavenowaytogetit,andyoucannotclosethetopology.YouralternativesaretoquitAutoCADMaporstartanewdrawing.

Page 377: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acqtyAccessFunctions

Countstopologies.

(tpm_acqty[source[loaded]])

Returnsatopologycount(integer)ornil.

source SourceflagTornil:TCounttopologiesincurrentandsourcedrawingsnilCounttopologiesincurrentdrawingonly(default)

loaded LoadedinmemoryflagTornil:TCountonlytopologiesinmemorynilCountalltopologies(default)

Page 378: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acunloadAccessFunctions

Unloadsatopologyfrommemory.

(tpm_acunloadtoponame)

ReturnsTornil.

toponame Topologyname(string)

Beforeatopologycanbeunloaded,alltopologyIDsthatreferenceitmustbeclosedwithtpm_acclose.

Page 379: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acupgradeopenAccessFunctions

Allowswriteaccessforatopologythatisopenwithoutit.

(tpm_acupgradeopentpm_id)

ReturnsTornil.

tpm_id TopologyID(real)returnedbytpm_acopen

Ifatopologyisalreadyopenwithwriteaccess,youcannotupgradeaccesswiththisfunction.Youcannotupgradeaccesstowriteforasourcetopology.

Page 380: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_anabufferAnalyzingFunctions

Createsabufferspacearoundatopology.

(tpm_anabuffersource_idoffsetvar_id[result_name][result_desc])

ReturnsTornil.

source_id SourcetopologyID(real)

offset Bufferoffset(string),astandardDataExtensionexpression

var_id TopologyvariablesID(real)

result_name Resultingtopologyname(string)ornil

result_desc Resultingtopologydescription(string)ornil

ThetopologyvariablesIDreferencesasetoftopologyvariables.

Thisfunctiondrawsoneormorebufferperimeters.Iftheresultargumentisomittedornil,thebufferedtopologiesareAutoCADobjectsonly.Otherwisethefunctioncreatesanewtopologythatisloadedbutnotopen.

Thesourcetopologymustbeloadedandopen.TheRead/Writeaccessofthesourcetopologydoesnotaffectthisfunction.

Youcanbufferanyofthethreetopologytypes,node,network,orpolygon.

Page 381: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_anadissolveAnalyzingFunctions

Mergesconnectedtopologyelementsthathavethesamevalueinthespecifiedfield.

(tpm_anadissolvesource_idfieldvar_id[result_name][result_desc][objtable][objcolumn])

ReturnsTornil.

source_id SourcetopologyID(real).Polygonornetworktopologyonly.

field Dissolvefieldname(string),astandardDataExtensionexpression.Forexample,:Value@Tab1,.Layer.

var_id TopologyvariablesID(real).

result_name Nameofnewtopology(string);topologyisloadedbutnotopen.Ifargumentisomittedornil,thedissolveresultsinacollectionofAutoCADobjects.

result_desc Resultingtopologydescription(string)ornil.

objTable Objectdatatablename(string)ornil.

objColumn Objectdatafieldname(string)ornil.

ThetopologyvariablesIDreferencesasetoftopologyvariables.

Page 382: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thefunctionworksforpolygonornetworktopologies.Ifitfindstwoormoreattachedobjectsthathavethesamevalueinthespecifieddissolvefield,itdissolvesthem.

Dissolvingpolygonsdeletestheircentroidsandsharedlinksandcreatesanewpolygonwithanewcentroid.Dissolvinglinksdeletessharednodes.Thelinksaremergedintoonepolyline.

Thefunctionwritestheshareddissolvefieldvaluetotheobjectdatatableandfieldthatyouspecifyandattachesthetabletotheresultobject.Ifthistabledoesnotexist,thefunctioncreatesit.Ifthetableyouspecifyisalreadyattachedtooneofthesourceobjects,atablewithdefaultvaluesisattachedtotheresultobject.

Page 383: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_anaoverlayAnalyzingFunctions

Overlaystwotopologies.

(tpm_anaoverlayoverlay_idoverlay_datasource_idsource_dataopervar_id[obj_table][obj_tabledesc][result_name][result_desc])

ReturnsTornil.

overlay_id OverlaytopologyID(real)oftopology1.Mustbeapolygontopology.

overlay_data OverlaydataexpressioncomposedofAutoCADMapexpressionsandoutputobjectdatacolumnsornil.SeetheOverlayDataExpressionssectionbelow.

source_id SourcetopologyID(real)oftopology2.Mustbeapolygontopology.

source_data OverlaydataexpressioncomposedofAutoCADMapexpressionsandoutputobjectdatacolumnsornil.SeetheOverlayDataExpressionssectionbelow.

oper Overlayoperation(integer).SeetheOverlayOperationstablebelow.

var_id IDoftopologyvariablesforbuildingtheresulttopology(real).

obj_table Nameofthenewobjectdatatablethatwillcontainthefinaldata(createdbythefunction).Cannotbean

Page 384: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

existingtable.

obj_tabledesc Objectdatatabledescription.

result_name Resulttopologyname(string).OmitiffunctionresultsproducesAutoCADobjectsinsteadofatopology.

result_desc Resulttopologydescription(string).

Thesourcetopologymustbeofpolygontypeforunionandpasteoperations.Forallotheroperations,itcanbeofanytopologytype,suchasnode,network,andpolygon.

ThetopologyvariablesIDreferencesasetoftopologyvariables.

OverlayDataExpressions

Theoverlay_dataandsource_dataargumentsareoverlaydataexpressions.Theyhavethefollowingformat:

(list(listexpr1colname1coldesc1coltype1)(listexpr2...)...)

OverlayDataExpressionArguments

expr1 AutoCADMapexpression(string).

col_name1 Objectdatacolumnname(string).

col_desc1 Objectdatacolumndescription(string).

col_type1 Objectdatacolumntype(integer):1through4,where1=integer,2=real,3=character,and4=point.

OverlayOperations

Page 385: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

1 Intersect

2 Union

3 Identity

4 Erase

5 Clip

6 Paste

ResultTopology

Iftheresult_nameargumentisomittedornil,theresultisacollectionofAutoCADobjects.Otherwise,itisanewtopologythatisloadedbutnotopen.

Youmustspecifythelistofdatavaluestocomefromeachinputtopologyandthespecificdataforeach.

Additionally,youmustspecifythenameoftheresultobjectdatatableintheobjTableparametertocontainthefinaldata.Ifyoudonotspecifyaresulttable,nodataisattachedtotheresultingtopologyelements.Thefunctioncreatesthistable.Iftheresulttableyouspecifyalreadyexists,thefunctionreturnsanerrorandcancelstheoverlayprocess.

Dataderivedbytheoverlayprocessisalsoattachedtotheresultobjectdatatable.Thisdataiswrittenforeachtopologyelementintheresultingtopology.Itiswrittenforeachpolygonifthesourceisapolygontopology,foreachlinkifitisanetworktopology,orforeachnodeifitisanodetopology.Thetablealwaysincludesthefollowingfields:

FieldNamesinResultObjectDataTable

TOPO_ID ElementIDofthenewelementintheresulttopology

T1_ID ElementIDoftheparentpolygonintheoverlay

Page 386: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

topology

T1_PERCENTAREA Areaofthenewpolygonintheresulttopologycomparedtotheareaoftheparentpolygonintheoverlaytopology.Writtenonlyifbothoverlayandresultarepolygontopologies

T2_ID ElementIDofparentelementinthesourcetopology.Theparentelementcanbeanode,link,orpolygon.

T2_PERCENTAREA Areaofthenewpolygonintheresultingtopologycomparedtotheareaoftheparentpolygoninthesourcetopology.Writtenonlyifbothsourceandresultarepolygontopologies

Theresulttableincludesthesefieldsalongwiththefieldsthatyouspecifyintheargumentsyousupplyfortheoverlay_dataandsource_dataparameters.EachfieldnameisprefixedwithT1_orT2_toindicatewhichtopologyitsdatacomesfrom.

Forexample,ifyouspecifyFIELD1,FIELD2andFIELD3fromtableSOILforthefirsttopologyandFIELD1,FIELD4andFIELD5fromtableWATERforthesecond,theresulttablehasthefollowingfields:

T1_SOIL_FIELD1T1_SOIL_FIELD2T1_SOIL_FIELD3T1_WATER_FIELD1T1_WATER_FIELD4T1_WATER_FIELD5

Thefollowingcodeoverlaystwotopologies.Thenamest1andlist1refertotheoverlaytopology.

Page 387: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(setqt1(tpm_acopen"top1"));apolygontopology(setqt2(tpm_acopen"top2"))(setqv(tpm_varalloc))(setqlist1(list(list".LAYER""OVERLAY_LAYER"""3)))(setqlist2(list(list".LAYER""SOURCE_LAYER"""3)))(tpm_anaoverlayt1list1t2list21v"OVERLAY_TABLE"nil"OVERLAY_TOPO");Result_descargumentomitted

Page 388: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanactionlistdelCleanupFunctions

Deletesacleanupactionfromtheactionlist.

(tpm_cleanactionlistdelclean_var_idindex)

ReturnsTornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

index Positioninthelistoftheactiontodelete(integer)

Theclean_var_idargumentreferencespropertiesforthecleanupoperationthatyouarepreparingtoinitiate(seeCleanupVariables).Thesepropertiesincludetheactionlist.

Theindexargumentisazero-basedpositionintheactionlist.Avaluegreaterthanorequaltothelistsizeorlessthan0returnsanerror.

ADSRXEquivalent

inttpm_cleanactionlistdel

ade_idclean_var_id,longindex);

ReturnsRTNORMoranerrorcode.

Page 389: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanactionlistqtyCleanupFunctions

Getsthenumberofcleanupactionsintheactionlist.

(tpm_cleanactionlistqtyclean_var_id)

Returnsthenumberofcleanupactions(real)ornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

Theclean_var_idargumentreferencespropertiesforthecleanupoperationthatyouarepreparingtoinitiate(seeCleanupVariables).Thesepropertiesincludetheactionlist.

ADSRXEquivalent

inttpm_cleanactionlistqty

ade_idclean_var_id,long*qty);

ReturnsRTNORMoranerrorcode.

qty Outputsthenumberofcleanupactions

TheADSRXfunctionpassesthenumberofcleanupactionsthroughaparameter

Page 390: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(asalong)insteadofreturningit(asareal)astheAutoLISPfunctiondoes.

Page 391: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanallocCleanupFunctions

Allocatesthecleanupmodel.

(tpm_cleanalloc)

ReturnsthecleanupmodelID(real)ornil.

Tocleantheobjectsbeforetheybecometheelementsofatopology,youmustconstructamodeloftheseobjectsandtheirrelationships.Youcanusethismodeltodiscoverandrepairdrawingerrorsthatwouldpreventtopologycreation.

Page 392: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleananchorssCleanupFunctions

Getsacleanupmodel'sanchoredentities.

(tpm_cleananchorssclean_var_id)

Returnsaselectionsetofanchoredentitiesornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

Callthisfunctionaftercallingtpm_cleaninit.

ADSRXEquivalent

inttpm_cleananchorss

ade_idclean_var_id,ads_namess);

ReturnsRTNORMoranerrorcode.

ss Anchoredentities,aselectionset

Page 393: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleancancelCleanupFunctions

Cancelsthecleanupprocess.

(tpm_cleancancelclean_id)

ReturnsTornil.

clean_id CleanupmodelIDreturnedbytpm_cleanalloc

Thefunctionclearsthecleanupmodelwithoutupdatingthedrawing.Dooneofthefollowing:

Becausethemodelisstillallocated,youcancalltpm_cleaninitusingthesamecleanupmodelID.Youcanthenusetpm_cleanstarttostartthecleanupprocess.

Becausetpm_cleancanceldoesnotcancelinitializedvalues,youcanclearthecleanupmodelandcontinuewithoutcallingtpm_cleaninit.

Page 394: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleancompleteCleanupFunctions

Testsforgroupstoclean.

(tpm_cleancompleteclean_id)

ReturnsTifnomoregroupsneedcleaningornil.

clean_id ModelIDreturnedbytpm_cleanalloc.

Youmustcallthisfunctionaftertpm_cleangroupnexttodetermineifanothergroupneedscleaning,becausetpm_cleangroupnextdoesnotprovidethisinformation.

Youmustusuallyexecuteseveralcleanuploops,becausefixingoneerrorsometimescausesothers.Afteryouprocessallthegroupsintheselectionset,calltpm_cleanstarttoreturntothebeginning,andthencalltpm_cleancompletetotestifcleaningiscomplete.Repeattheloopuntilcleaningiscomplete.

Page 395: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanendCleanupFunctions

Concludesthecleanupprocess.

(tpm_cleanendclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Thefunctionresetsthecleanupmodelandupdatesthedrawing.Itfixeserrorsmarkedwiththetpm_cleanerrorfixfunction.Themodelisstillallocated.Itispossibletocalltpm_cleaninitusingthesamecleanupmodelID.

Eacherrorhassomedefaultmethod,whichtpm_cleanendusesduringerrorfixing.Tochangethismethod,usetpm_cleanerrorset.

Page 396: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrorcurCleanupFunctions

Setsthenexterrortocleaninthecurrentgroup.

(tpm_cleanerrorcurclean_idindex)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

index Indexoftheerrortoclean.Theindexofthefirsterroris0

Thenexterrortocleanisalsocalledthecurrenterror.

Page 397: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrordrawCleanupFunctions

Createsatemporarymarkerforthecurrenterror.

(tpm_cleanerrordrawclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Unlikethepersistentmarkersdrawnbytpm_cleanerrormark,thesemarkersaredeletedwhenthedrawingredraws.

Page 398: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrorfixCleanupFunctions

Fixesthecurrenterror.

(tpm_cleanerrorfixclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Thisfunctionmarksthecurrenterrortofix.Itfixestheerrorsinthecleanupmodel,butdoesnotfixthedrawing.Theobjectsinthedrawingarenotfixeduntilyoucalltpm_cleanend.

Eacherrorhasadefaultmethodthattpm_cleanendusesduringerrorfixing.Youcanusetpm_cleanerrorsettochangethismethod.Forexample,thedefaultmethodforthedanglingnodeerroristoerasethelink.Ifyoucalltpm_cleanerrorsetforthiserror,thedanglingnodeismovedtoanewposition,butisnoterased.

Page 399: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrorgetCleanupFunctions

Getsthecoordinatesofthecurrenterrorpoint.

(tpm_cleanerrorgetclean_id)

Returnsatwo-dimensionalpointornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Theerrorpointisamisplacednode.Forexample,foralineundershoot,theendoftheunattachedlineistheerrorpoint.

Tospecifytheerrortoget,usetpm_cleanerrorcur.

Page 400: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrormarkCleanupFunctions

Createsapersistentmarkerforthecurrenterror.

(tpm_cleanerrormarkclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Unlikethetemporarymarkerdrawnbytpm_cleanerrordraw,thesemarkersareAutoCADobjects,andtheybecomepartofthedrawinguntilyouperformanothercleanup.AutoCADMapautomaticallyerasespersistentmarkersfromanypreviouscleanupprocess.

Page 401: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanerrorsetCleanupFunctions

Setsthecoordinatesofanerrorfixpoint.

(tpm_cleanerrorsetclean_idcoords)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

coords 2Dpoint.

Youcanusethisfunctiontochangethedefaultmethodusedbytpm_cleanendduringerrorfixing.Forexample,thedefaultmethodforthedanglingnodeerroristoerasethelink.Ifyoucalltpm_cleanerrorsetforthiserror,thedanglingnodeismovedtothenewposition,butisnoterased.

Youcanalsousethisfunctiontomergeaclusterofpointstothepointyouspecify.

Totellthecleanenginewhicherrortoset,usetpm_cleanerrorcur.

Page 402: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanfreeCleanupFunctions

Freesthecleanupmodel.

(tpm_cleanfreeclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Page 403: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupdrawCleanupFunctions

Createstemporarymarkersforallerrorsofthecurrentgroup.

(tpm_cleangroupdrawclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Page 404: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupfixCleanupFunctions

Fixesallerrorsofthecurrentgroup.

(tpm_cleangroupfixclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Thisfunctionmarkserrorsintheentirecurrentgroupforfixing.Itfixestheerrorsinthecleanupmodel,butdoesnotfixthedrawing.Theobjectsinthedrawingarenotfixeduntilyoucalltpm_cleanend.

Tomarkonlythecurrenterror,usetpm_cleanerrorfix.

Page 405: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupmarkCleanupFunctions

Createspersistentmarkersforallerrorsofthecurrentgroup.

(tpm_cleangroupmarkclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

Page 406: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupnextCleanupFunctions

Goestothenexterrorgroup.

(tpm_cleangroupnextclean_id)

ReturnsTornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

ThefunctionalwaysreturnsT,andfailsonlywhentheclean_idparameterisinvalid.Itcannotinformyouwhentherearenomoregroupstoclean.Tocheckforthiscondition,usetpm_cleancomplete.

Page 407: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupqtyCleanupFunctions

Countstheerrorsinthecurrentgroup.

(tpm_cleanqroupqtyclean_id)

Returnstheerrorcount(real)ornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

IntheADSRXequivalentfunction,theerrorcounttypeislong.Becausethis32-bitdatatypeisnotavailableinVisualLISP,theVisualLISPfunctionusesthe32-bittypereal.

Page 408: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleangroupsubtypeCleanupFunctions

Determinesthesubtypeofthecurrentgroup.

(tpm_cleangroupsubtypeclean_id)

Returnsasubtypecodeornil.

clean_id ModelID(real)returnedbytpm_cleanalloc

SubtypeCodes

1 Degenerateentities(subtypeofEraseShortObjects)

2 Shortentities(subtypeofEraseShortObjects)

3 Shortsegments(subtypeofEraseShortObjects)

4 Vertexisneartosegment(subtypeofExtendUndershoots)

5 Vertexisneartovertex(subtypeofExtendUndershoots)

Codes1through3aresubtypesoftheshorttype.Codes4and5aresubtypesoftheundershoottype.Thisfunctionisusefulforshortandundershooterrorsonly.

DegenerateEntitiesAdegeneratepolylinehasonlyonevertex.Thisinvalidvertextypesometimesresultsfromthedrawingcleanupprocess,andcanberemovedbyfurtherdrawingcleanup.

Page 409: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanincludessCleanupFunctions

Getsacleanupmodel'sIncludeset.

(tpm_cleanincludessclean_var_id)

ReturnstheIncludeset,theselectionsetofentitiestobecleaned.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

Callthisfunctionaftercallingtpm_cleaninit.

ADSRXEquivalent

inttpm_cleanincludess

ade_idclean_var_id,ads_namess);

ReturnsRTNORMoranerrorcode.

ss Entitiestobecleaned,aselectionset

Page 410: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleaninitCleanupFunctions

Initializesthecleanupmodel.

(tpm_cleaninitclean_idvar_idss)

ReturnsTornil.

clean_id CleanupmodelID(real)returnedbytpm_cleanalloc

var_id CleanupvariablesID(real)returnedbytpm_varalloc

ss Selectionsetornil(seenotebelowaboutINCLUDEOBJS_AUTOSELECT)

Youcanfreetheselectionsetafterthecleanupmodelhasbeeninitialized.

Thefunctionreadsthecleanupsettingsandtheselectedentitiesintothecleanupmodel.

IfthecleanupvariableINCLUDEOBJS_AUTOSELECTissetto1(selectall),allentitiesinthedrawingwillbeincluded,regardlessofthessargument,inwhichcasethisargumentcanbenilinsteadofaselectionset,asthefollowingcodesampleillustrates.

(setqclean_id(tpm_cleanalloc))(setqvar_id(tpm_varalloc))(tpm_varsetvar_id"INCLUDEOBJS_AUTOSELECT"1)(setqssIncludenil)

Page 411: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(tpm_cleaninitclean_idvar_idssInclude)

IfthecleanupvariableINCLUDEOBJS_LAYERSissetto"*"(alllayers),allssentitieswillbeincluded.Ifitcontainsalistoflayers,ssentitieswillbeincludedonlyiftheyresideonthoselayers.

ThecleanupvariablesIDreferencesasetofcleanupvariables.

Page 412: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleaninitanchorsetCleanupFunctions

Specifiesanchoredentitiesforthecleanupmodel.

(tpm_cleaninitanchorsetclean_idclean_var_idssanchor)

Returnstornil.

clean_id CleanupmodelID(real)returnedbytpm_cleanalloc

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

ssanchor Entitiestobeanchored,aselectionset

Anchoredentitiesremainfixedinpositionduringthecleanupprocess.Youcanfreetheselectionsetafteranchoredentitieshavebeenspecified.

Calltpm_cleaninitanchorsetbeforecallingtpm_cleaninit.

Theclean_var_idargumentreferencespropertiesforthecleanupoperationthatyouarepreparingtoinitiate(seeCleanupVariables).

IfthecleanupvariableANCHOROBJS_LAYERSissetto"*"(alllayers),allssAnchorentitieswillbeanchored.Ifitcontainsalistoflayers,ssAnchorentitieswillbeanchoredonlyiftheyresideonthoselayers.

ADSRXEquivalent

int

Page 413: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleaninitanchorsetade_idclean_id,ade_idclean_var_id,ads_namessAnchor);

ReturnsRTNORMoranerrorcode.

Page 414: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanprofileloadCleanupFunctions

Loadsadrawingcleanupprofile.

(tpm_cleanprofileloadclean_var_idfilename)

ReturnsTornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

filename Fullpathand.dpffilename(string)

NoteLoadingaprofilewillresetallpropertiesreferencedbytheclean_var_idargument.

ADSRXEquivalent

inttpm_cleanprofileload

ade_idclean_var_id,char*filename);

ReturnsRTNORMoranerrorcode.

Page 415: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanprofilesaveCleanupFunctions

Savesadrawingcleanupprofile.

(tpm_cleanprofilesaveclean_var_idfilename)

ReturnsTornil.

clean_var_id CleanupvariablesID(real)returnedbytpm_varalloc

filename Fullpathand.dpffilename(string)

ADSRXEquivalent

inttpm_cleanprofilesave

ade_idclean_var_id,char*filename);

ReturnsRTNORMoranerrorcode.

Page 416: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_cleanstartCleanupFunctions

Startsthecleanupprocess.

(tpm_cleanstartclean_id)

ReturnsTornil.

clean_id CleanupmodelID(real)returnedbytpm_cleanalloc

Thefunctionfindsthefirstgrouptypeorsubtypethatcontainserrors.Seetpm_cleangrouptypeandtpm_cleangroupsubtypeforlistsoftypes.

Cleanupisaniterativeprocess.Dependingoncleanupoptionsandprocessingorder,youmayneedtorunthecleanuploopseveraltimestoachievethedesiredresults.Afterselectingthegroupstoprocesswithtpm_cleangrouptypeandprocessingallthegroupsintheselectionset,calltpm_cleancompletetotestifcleaningiscomplete.Ifcomplete,calltpm_cleanstartandrepeatthecleanuploop.

Page 417: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_editaddelemEditingFunctions

Addsanelementtoatopology.

(tpm_editaddelemtpm_idtypeelem)

ReturnsTornil.

tpm_id TopologyID(real).

type Elementtypecode(integer):1,2,or3,where1=Node,2=Link,and3=Polygon.

elem Elementtoadd.Dependingonthetypeargument,specifyoneofthefollowing:If1,specifyapointortheentitynameofapointobject.If2,specifytheentitynameofalineobject.If3,specifyaselectionset.

ThetopologymustbeopenwithWriteaccess.Ifyouaddanodetoalink,thelinkissplit.

Page 418: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_editdelelemEditingFunctions

Deletesanelementfromatopology.

(tpm_editdelelemtpm_idelem_id[delobjs])

ReturnsTornil.

tpm_id TopologyID(real)

elem_id ElementID(real)

delobjs Tornil:TDeleteobjectfromthedrawingalsonilDeleteobjectfromthetopologyonly

Thisfunctiondeleteselementsfromatopology.ItdoesnoterasecorrespondingentitiesinthedrawingunlessthedelobjsargumentisT.

WarningDeletinganelementcancauseotherdeletions.

Ifyoudeleteanode,youdeleteanylinkorpolygonthatcontainsit.Ifyoudeletealink,youdeleteonlythenodesbelongingtothatlink.Ifthelinkbelongstoonepolygononly,youdeletethepolygon.Ifthelinkissharedbytwopolygons,youmergethepolygons.Ifyoudeleteapolygon,youdeleteanynodeorlinkbelongingtothatpolygononly.

Page 419: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_editmodelemEditingFunctions

Modifiesatopologyelement.

(tpm_editmodelemtpm_idelem_idnew_val)

ReturnsTornil.

tpm_id TopologyID(real)

elem_id ElementID(real)

new_val Listconsistingofacodeforthepropertytomodifyandanewvaluefortheproperty.SeePropertiesandValuesbelow.

PropertiesandValues

(10.point) Newcoordinatesofnodeorcentroid(point)

(40.f_res) Resistanceofnode(real),orforwardresistanceoflink

(41.r_res) Reverseresistanceoflink(real)

(70.dir) Linkdirection(integer):-1Reverse0Bidirectional1Forward

Thefollowingexampleassignsnewcoordinatestothefirstnodeinanode

Page 420: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

topology.

(setqnode_ss(ssget))(setqvar_id(tpm_varalloc))(setqresult(tpm_mntbuildvar_id"test""testdescr"1node_ss))(setqtpm_id(tpm_acopen"test"T));openforwrite(setqelem_id(tpm_elemidtpm_id10));getsfirstnode(setqresult(tpm_editmodelemtpm_idelem_id(cons10(list1.01.00.0))))

Page 421: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_editupdelemEditingFunctions

Updatesatopologyelement.

(tpm_editupdelemtpm_idelem_id)

ReturnsTiftheobjectwassuccesfullyupdatedornilifitwasnot.

tpm_id TopologyID(real)

elem_id ElementID(real)

ThisfunctionupdatesatopologyelementsothatitreflectsthecurrentstateofthecorrespondingentityinAutoCAD.ThisfunctionisnormallyusedinconjunctionwithAutoCADNotificationsothatchangesmadeinAutoCADcanbereflectedinthetopologymodel.

Page 422: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemadjElementInformationFunctions

Compilesalistofadjacentelementsforthespecifiedelement.

(tpm_elemadjtpm_idelem_idadj_type)

ReturnsalistofelementIDsornil.

tpm_id TopologyID(real)

elem_id ElementID,receivedfromtpm_elemid

adj_type Typeofadjacentelements(int).Values:1Node2Pink3Polygon

Page 423: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemfindElementInformationFunctions

Findsanelementwithinatopology.

(tpm_elemfindtpm_idtypepattern)

ReturnsanelementID(real)ornil.

tpm_id TopologyID(real)

type Typeofelementtofind(int).Values:1Node2Link3Polygon

pattern Pointorentityname.Ifpatternisapoint,inwhichcasetypemustbe1,thefunctionreturnsthenearestpointorlink,ortheenclosingpolygon.Ifpatternisanentityname,inwhichcasetypecanhaveanyvalue,thefunctionreturnsthecorrespondingobject.

ThefollowingexamplegetsapointfromtheuserandfindsthenearestnodeinthetopologynamedParcel.

(setqpt(getpoint))(setqtopo_id(tpm_acopen"Parcel"))(setqnode_id(tpm_elemfindtopo_id1pt))

Page 424: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TheresultisanodeID,suchas4.71389e+007.

Page 425: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemgetElementInformationFunctions

Listsinformationaboutanelementofatopology.

(tpm_elemgettpm_idelem_id)

Returnsalistofdottedpairsornil.

tpm_id TopologyID(real)

elem_id ElementID(tpm_id)returnedbytpm_elemid

Foreachdottedpairinthelistthatisreturned,thefirstvalueisanintegercodefortheinformationtype,andthesecondvalueistheinformation.Thelistformatdependsontheelementtype:node,link,orpolygon.

InformationListFormatforNodes

Type Information

0 PersistenttopologyID(real).

-1 Elementtypecode(integer).Withnodelists,always1,meaningnodeelement.

-2 Entitynameofthenodeobject(real).

10 Coordinatesofthenodeobject(point).

40 Noderesistance(real).Relevantonlyfornodesbelongingtonetwork

Page 426: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

orpolygontopologies.

InformationListFormatforLinks

Type Information

0 PersistenttopologyID(real).

-1 Elementtype(integer).Withlinklists,always2,meaninglinkelement.

-2 Entitynameofthelinkobject(real).

1 TopologyIDofstartnode(real).

2 TopologyIDofendnode(real).

3 TopologyIDofleftpolygon(real).Relevantonlyifthelinkbelongstoapolygontopology.Linksinapolygontopologycanbelongtotwoadjacentpolygons,oneontheleft,andoneonetheright.

4 TopologyIDofrightpolygonthatsharesthislink(real).Relevantonlyifthelinkbelongstoapolygontopology.

40 Forwardresistanceofthelink(real).

41 Reverseresistanceofthelink(real).

70 Linkdirection(integer):-1,0,or1,where-1=Reverse,0=Bidirectional,and1=Forward.

InformationListFormatforPolygons

Type Information

0 PersistenttopologyID(real).

-1 Elementtype(integer).Withpolygonlists,always3,meaningpolygonelement.

Page 427: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

-2 Entitynameofthepolygoncentroid(real).

10 Coordinatesofthepolygoncentroid(point).

50 Perimeterofthepolygon(real).

51 Areaofthepolygon(real).

Whenatopologyisbuilt,itisgivenasetofobjectdatafields.Theirpurposeistocontaintheinformationlistedintheprecedingtables.

Page 428: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemidElementInformationFunctions

GetstheIDofanelement.

(tpm_elemidtpm_idtypeindex)

ReturnsanelementID(real)ornil.

tpm_id TopologyID(real)

type Elementtype(integer).Values:1Node2Pink3Polygon

index Elementindex(real).Theindexofthefirstelementis0

Page 429: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemqtyElementInformationFunctions

Countstopologyelements.

(tpm_elemqtytpm_idtype)

Returnsanelementcount(real)ornil.

tpm_id TopologyID(real)

type Elementtype(int).Values:1Node2Link3Polygon

IntheADSRXequivalenttothisfunction,theelementcounttypeislong.Becausethis32-bitdatatypeisnotavailableinVisualLISP,theVisualLISPfunctionusesreal,another32-bittype.

Page 430: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_elemssElementInformationFunctions

Createsaselectionsetofelementsofagiventype.

(tpm_elemsstpm_idtype)

Returnsaselectionsetornil.

tpm_id TopologyID.

type Elementtype(int).Values:1Node2Pink3Polygon

Page 431: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infobuildvarTopologyInformationFunctions

Getstheconfigurationvaluesofatopology.

(tpm_infobuildvartpm_idvar_id)

ReturnsTornil.

tpm_id TopologyID(real)

var_id TopologyvariablesID(real)

ThetopologyvariablesIDreferencesasetoftopologyvariablesinwhichtostorethevaluesthatthisfunctiongets.

Ifnotopologyvariablesareallocated,calltpm_varalloctoallocateasetofthemandreturntheirID.

Toreadthevaluesthatthisfunctiongets,usetpm_vargetortpm_varlist.Tobuildanewtopologyusingthesevariables,usetpm_mntbuild.

Thefollowingcodeopensatopology,readsitsconfigurationvalues,andgetsitsnodelayer.

(setqtpm_id(tpm_acopen"SampleTopo"))(setqvar_id(tpm_varalloc))(tpm_infobuildvartpm_idvar_id)(tpm_acclosetpm_id)(setqnlayer(tpm_vargetvar_id"NODE_LAYER"))

Page 432: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infocompleteTopologyInformationFunctions

Testsifapolygontopologyiscomplete.

(tpm_infocompletetpm_id)

ReturnsTifthetopologyiscomplete,nil.

tpm_id TopologyIDofapolygontopology.

Usethisfunctiontoverifythatapolygontopologyiscompletebeforeperforminganelementtrace,overlay,orothertopologyoperation.Thisfunctionappliesonlytopolygontopologies.

Atopologyisconsideredcompleteifallnecessaryentitiesexistinthecurrentdrawing.Itisconsideredincompleteifatleastonepolygonisincomplete.

Aquerycanbringanincompletetopologyintothecurrentdrawing.Becausethisparthasthesamenameasthecompletetopologythatitcamefrom,thepartcouldbemistakenforthewhole.Althoughyoucanexecuteanytopologyoperationonanincompletetopology,theresultmaynotbewhatyouintend.

Page 433: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infocorrectTopologyInformationFunctions

Testswhetheratopologyiscorrectandperformsageometricalaudit.

(tpm_infocorrecttpm_id)

ReturnsTornil.

tpm_id TopologyID.

Iftopologyentitiesarechangedusingdrawingtools,thetopologyinformationismodifiedaccordingtothegeometricalchanges.Ifthisisimpossible,thetopologybecomesincorrect.Usethisfunctiontoverifythatatopologyiscorrectbeforeperforminganelementtrace,overlay,orothertopologyoperation.Seealsotpm_infomodified.

Tofixanincorrecttopology,tryunloadingandreloadingit.Ifitdoesnotreload,youmustusetopologyedittofixthetopology.Ifthisdoesnotwork,rebuildthetopology.

NoteThisfunctionindicateswhenanerroroccurs,butdoesnotshowitslocation.

Page 434: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infocurrentTopologyInformationFunctions

Checksthesourcefromwhichthetopologywasloaded.

(tpm_infocurrenttpm_id)

ReturnsTifthetopologyisloadedfromthecurrentdrawing,ornilifitcomesfromsourcedrawings.

tpm_id TopologyID.

Page 435: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infodescTopologyInformationFunctions

Getsatopologydescription.

(tpm_infodesctpm_id)

Returnsatopologydescription(string)ornil.

tpm_id TopologyID(real)

Page 436: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infomodifiedTopologyInformationFunctions

Checksiftopologyelementshavebeenmodifiedusingdrawingtools.

(tpm_infomodifiedtpm_id)

ReturnsTifanyelementshavebeenmodified,otherwisenil.

tpm_id TopologyID.

Iftopologyelementshavebeenmodifiedusingdrawingtools,thenpossiblytheyarenolongercorrecttopologies.Seealsotpm_infocorrect.

Page 437: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infonameTopologyInformationFunctions

Getsatopologyname.

(tpm_infonametpm_id)

Returnsatopologyname(string)ornil.

tpm_id TopologyID(real)

Page 438: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infostatusTopologyInformationFunctions

CheckswhetherthetopologyisopenforReadorWriteaccess.

(tpm_infostatustpm_id)

ReturnsTifthetopologyisopenforWriteornilifopenforRead.

tpm_id TopologyID(real)

Page 439: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infotypeTopologyInformationFunctions

Getsatopologytype.

(tpm_infotypetpm_id)

Returnsatopologytypecode(int)ornil.

tpm_id TopologyID(real)

Topologytypecodes:1=node,2=network,3=polygon.

Page 440: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_infoversionTopologyInformationFunctions

Getsatopologyversion.

(tpm_infoversiontpm_id)

Returnsatopologyversion(string)ornil.

tpm_id TopologyID(real)

Atopology'sversionistheDataExtensionversion(ADE)inwhichthetopologywascreated.Forexample,"2.026".Thisfunctiongetsthesameresultastpm_iterversion.Thedifferenceisthattpm_infoversionrequiresatopologyID,anditworksonlyontopologiesthatareopen.

Page 441: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iterdescTopologyIteratingFunctions

Getsatopologydescription.

(tpm_iterdesciter_id)

Returnsatopologydescription(string)ornil.

iter_id IteratorID.

Thefunctiongetsadescriptionofthetopologythattheiteratorpointsto.

ForanexamplethatshowshowyoucanuseTopologyIteratingfunctionstofindallthetopologiesthesystemknowsabout,seetpm_iterstart.

Page 442: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iternameTopologyIteratingFunctions

Getsatopologyname.

(tpm_iternameiter_id)

Returnsatopologyname(string)ornil.

iter_id IteratorID(real)

Thefunctiongetsthenameofthetopologythattheiteratorpointsto.

ForanexamplethatshowshowyoucanuseTopologyIteratingfunctionstofindallthetopologiesthesystemknowsabout,seetpm_iterstart.

Page 443: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iternextTopologyIteratingFunctions

Movestheiteratortothenexttopology.

(tpm_iternextiter_id)

ReturnsTornilifanothertopologyisnotpresent.

iter_id IteratorID(real)

Thefirsttimethisfunctioniscalledaftertpm_iterstart,itsetstheiteratoronthefirsttopologydefinition.

ForanexamplethatshowshowyoucanuseTopologyIteratingfunctionstofindallthetopologiesthesystemknowsabout,seetpm_iterstart.

Page 444: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iterstartTopologyIteratingFunctions

Allocatingatopologyiterator.

(tpm_iterstart[source[loaded]])

ReturnsaniteratorID(real)ornil.

source Sourceflag(int):TIteratethroughthecurrentandsourcedrawingsnilIteratethroughthecurrentdrawingonly(default)

loaded Loadedinmemoryflag(int):TIteratethroughtopologiesinmemoryonlynilIteratethroughalltopologies(default)

Thisfunctionallocatesaniteratorandpositionsitbeforethefirsttopologydefinition.Thisbehaviorhasimplicationstorememberwhenyouusethefunction.

Becausetpm_iterstartalwaysgeneratesaniteratorID,evenifthedrawinghasnotopologiestoiteratethrough,thefunctionfailsonlywhenitisoutofmemory.

Becausetpm_iterstartpositionstheiteratorbeforethefirsttopologydefinition,thefunctioncannotindicatewhetheranytopologiesexistinthedrawing.Theonlywaytodeterminewhetherthedrawinghastopologiesistocalltpm_internext,whichfailsifnotopologyexistsbeyondthecurrentpositionoftheiterator.

Page 445: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Youcanhavemorethanoneiteratorrunningatthesametime.

ThisexampleshowshowyoucanuseTopologyIteratingfunctionstofindallthetopologiesthesystemknowsabout.

(setqitr_id(tpm_iterstart))(if(nullitr_id)(prompt"\nERROR:Unabletostarttopologyiterator.")(while(notdone)(if(null(tpm_iternextitr_id))(setqdoneT)(progn(setqlst(list(tpm_iternameitr_id)(tpm_itertypeitr_id)(tpm_iterdescitr_id)))(setqtpmlist(conslsttpmlist)));progn);if);while);if

Page 446: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iterstopTopologyIteratingFunctions

Freesaniterator.

(tpm_iterstopiter_id)

ReturnsTornil.

iter_id IteratorID(real)

Page 447: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_itertypeTopologyIteratingFunctions

Getsatopologytype.

(tpm_itertypeiter_id)

Returnsatopologytypecode(int)ornil.

iter_id IteratorID(real)

Thefunctiongetsthetypeofthetopologythattheiteratorispointingto.Thetopologytypecodesare1=node,2=network,3=polygon.

ForanexamplethatshowshowyoucanuseTopologyIteratingfunctionstofindallthetopologiesthesystemknowsabout,seetpm_iterstart.

Page 448: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_iterversionTopologyIteratingFunctions

Getsatopologyversion.

(tpm_iterversioniter_id)

Returnsatopologyversion(string)ornil.

iter_id IteratorID(real)

Thefunctiongetstheversionofthetopologythattheiteratorispointingto.TheversionofatopologyistheversionofADEinwhichitwascreated,forexample,"2.026".Thefunctiongetsthesameresultastpm_infoversion.Thedifferenceisthattpm_infoversionrequiresatopologyID,andsoitworksonlyontopologiesthatareopen.

Page 449: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_mntbuildBuildingandErasingFunctions

Buildsatopology.

(tpm_mntbuildvar_idnamedesctypenode_ss[link_sscntr_ss])

ReturnsTornil.

var_id TopologyvariablesID(real)

name Topologyname(string)

desc Topologydescription(string)

type Topologytypecode(int):1Node2Network3Polygon

node_ss Entityselectionsetofnodesornil

link_ss Entityselectionsetoflinksornil.Omitfornodetopology

cntr_ss Entityselectionsetofcentroidsornil.Omitfornodeandnetworktopology

ThetopologyvariablesIDreferencesasetoftopologyvariables.

Thenewtopologyisloaded,butclosed.Youmustopenitwithtpm_acopen.

Page 450: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ThefollowingAutoCADobjecttypesareacceptablefortopologyelements:

Forlinks:line,arc,circle,2Dand3DpolylineFornodesandcentroids:point,insert,andtext

Anodetopologycancontainonlynodes.Anetworktopologycancontainnodesorlinks,butnotcentroids.Apolygontopologycancontainallthree.

Whenthetopologyisbuilt,alllinksareassignedadefaultdirectionofbidirectional(avalueof0).Theforwardandreverseresistancevaluesarethelengthofthelink.Nodesareassignedaresistanceof0.

Whenatopologyisbuilt,itisgivenasetofobjectdatafields.Thesefieldscontaininformationabouttheelementsofthetopology.

Page 451: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_mnteraseBuildingandErasingFunctions

Erasesaclosedtopologyfromthecurrentdrawing.

(tpm_mnterasetoponame)

ReturnsTornil.

toponame Topologyname(string)

Thisfunctioncaneraseaclosedtopologywhetherornotitisloaded.

Page 452: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_mntrebuildBuildingandErasingFunctions

Rebuildsatopology.

(tpm_mntrebuildtoponame)

ReturnsTornil.

toponame Topologyname(string)

Therebuilttopologyisloaded,butclosed.Youmustopenitwithtpm_acopen.

Rebuildingatopologyrestoresallitsobjectdatafieldstotheirdefaultvalues.Anyobjectdatafieldsmodifiedafterthetopologywasbuiltarelost.SeeTopologyObjectData.

Whetheryouneedtorebuildatopologyafteryouchangeitdependsuponthefunctionsusedtomakethechanges.

IfchangesweremadeusingAutoCADdrawingandeditingfunctions,youmayneedtorebuildthetopology.

IftheAutoCADalterationsintroduceanerror,therebuildcouldfail.Ifthishappens,youmustcleantheobjectsagainandusetpm_mntbuild.Youcanusetpm_infocorrecttocheckforerrorsbeforeattemptingtpm_mntrebuild.

IfchangesweremadeusingTopologyfunctions,youdonothavetorebuildthetopology.Thisappliestoobjectsalteredwithfunctionssuchastpm_editaddelem,tpm_editdelelem,andtpm_editmodelem.

Page 453: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_mntrenameBuildingandErasingFunctions

Renamesatopology.

(tpm_mntrenametoponamenewnamenewdesc)

ReturnsTornil.

toponame Topologyname(string).

newname Newtopologyname(string).

newdesc Newtopologydescription(string)

Page 454: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_qrygetresdescTopologyQueryFunctions

Getsthedescriptionofthequeryresulttopology.

(tpm_qrygetresdesc)

Returnsatopologydescription(string)ornilifthereisnoresulttopologyorithasnodescription.

Page 455: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_qrygetrestopoTopologyQueryFunctions

Getsthenameofthequeryresulttopology.

(tpm_qrygetrestopo)

Returnsatopologyname(string)ifthereisaresulttopologyornilifthereisnot.Ifnoresulttopologyisdefined,thennoobjectsareaddedtothecurrentdrawingwhenthequeryexecutes.

Ifthenameofthequeryresulttopologystartswith*,theresulttopologyisatemporarytopology

Page 456: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_qrygettoponameTopologyQueryFunctions

Getsthenameofthequerysourcetopology.

(tpm_qrygettoponame)

Returnsatopologyname(string)ifthereisaquerysourcetopologyornilifthereisnot.Ifthereisaquerysourcetopology,thecurrentqueryisatopologyquery.Ifthereisnot,thecurrentqueryisastandarddataextensionquery.

Page 457: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_qrysetrestopoTopologyQueryFunctions

Definesororundefinesaqueryresulttopology.

(tpm_qrysetrestoporesult_nameresult_desc)

ReturnsTornil.

result_name Nameofthequeryresulttopology(string)ornil

result_desc Descriptionofthequeryresulttopology(string)ornil

Adescriptionisoptional.Itspresenceorabsencehasnoeffectonthequery.Regardingthename:

Ifnonameisspecified,thennoqueryresulttopologyisdefined.Ifadefinitionalreadyexists,itiscanceled.Ifthenamebeginswithanasterisk(*),thenextqueryresultisatemporarytopology.Ifthenamebeginswithanyotheracceptablecharacter,thenextqueryresultisastandardtopology.

Page 458: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_qrysettoponameTopologyQueryFunctions

Definesorundefinesatopologyquery.

(tpm_qrysettoponametoponame)

ReturnsTornil.

toponame Nameoftopologytoquery(string)ornil

Thisfunctiondetermineswhetherthecurrentqueryisatopologyqueryorastandarddataextensionqueryasfollows:

Ifthetoponameargumentisnil,thecurrentquerybecomesastandarddataextensionquery.

Ifthetoponameargumentisaname,thecurrentquerybecomesatopologyquery.Butifyouspecifyatopologythatdoesnotexist,asubsequentcalltoade_qryexecutereturnsnil.

Page 459: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceallocNetworkTracingFunctions

Allocatesthetracingmodel.

(tpm_tracealloctpm_id[node_reslink_dirlink_forward_reslink_reverse_res])

ReturnsthetracingmodelID(real)ornil.

tpm_id TopologyID(real)

node_res Expressionfornoderesistance(string):nil=Defaultresistance

link_dir Expressionforlinkdirection(string):nil=Defaultdirection

link_forward_res Expressionforforwardlinkresistance(string):nil=Defaultresistance

link_reverse_res Expressionforreverselinkresistance(string):nil=Defaultresistance

Thisfunctionsetsthevaluesforthespecifiedtopologytotheparametersyouenter.Thevaluesstoredintopologyobjectdatawhenthetopologywascreatedareusedasdefaultsifyouomitparameters.Youcanenteranyvalidexpressionthatevaluatestoanumericresult.

Thetracingmodelcanbeusedonlywithanetworkorpolygontopology.

Page 460: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Whenyouenteravalueotherthannilforanyoftheoptionalresistancearguments,thisvalueisusedforallobjectsinthetopologyoftheappropriatetype.Itoverridesthecorrespondingvalueattachedtotheobject.Forexample,ifnode_resissettonil,thetracingmodelusesthevalueattachedtotopologyobjectdatawhencalculatingthetrace.Ifnode_resissetto10.0,allnodesinthetopologyareoverriddenwiththevalueof10.0whenthetraceiscalculated.

Ifyouwanttoomittheoptionalparameters,youcaneitherenterniltoinvokeadefaultvalueorleaveouttheparameteraltogether,aswithotherVisualLISPfunctions.However,beforeyouomitoptionalparameters,notethedependencyrelationshipsindicatedbybracketedgroups.Forexample,ifyouwanttousethelink_dirparameter,youmustenteranode_resparameter.

Important!WhenusingtheTopologyAPItoperformanetworktrace,suchasaBestRouteanalysis,thesourcetopologyusedtocreatethetracetopologyshouldnotbeunloadedoreraseduntilafterallAPIcallsrelatingtothetracehavebeenmade.Thisisbecausethetracetopologyreferencesthenodesandlinksinthesourcetopology.Itdoesnotcreateitsown.So,inordertodoanythingwiththeelementsofthetrace,thesourcetopologymustremainloaded.

Forexample,thefollowingBestRoutecodewillsilentlyfail:

;topo_idisthenetTopotopology(tmp_id)(setqtopo_id(tpm_acopentopo_nameT))

;createthetracemodel(setqnetwork_trace_id(tpm_tracealloctopo_id))

;createthebestroute(setqbestroute(tpm_tracebestroutetopo_idnetwork_trace_id7.01.04.09.05.06.08.0))

;removethenetTopotopology;THISSHOULDNOTBEDONEUNTILAFTERBESTROUTETOPOQUERIESAREDONE.(tpm_acclosetopo_id)(tpm_acunloadtopo_name)

;thisnextcallfailsbecausetheelementinfoisonthesourcetopology(setqBestRouteTraceElement(tpm_tracebestroutescannetwork_trace_id3))

Page 461: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Thesimplesolutionistodeferthecallstotpm_accloseandtpm_acunloaduntilafteralltpm_tracebestroutescancalls.

Page 462: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceelemeditNetworkTracingFunctions

Modifiesatracingmodelelement.

(tpm_traceelemedittrace_idelem_idnew_val)

ReturnsTornil.

trace_id ModelID(returnedbytpm_tracealloc)

elem_id ElementID(real)

new_val Listconsistingofacodeforthepropertytomodifyandanewvaluefortheproperty.SeePropertiesandValuesbelow.

PropertiesandValues

(40.f_res) Resistanceofnode(real),orforwardresistanceoflink

(41.r_res) Reverseresistanceoflink(real)

(70.dir) Linkdirection(integer):-1Reverse0Bidirectional1Forward

Page 463: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceelemgetNetworkTracingFunctions

Listsinformationaboutatracingmodelelement.

(tpm_traceelemgettrace_idelem_id)

Returnsaninformationlistornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

elem_id TraceelementID(real)

Thelistformatdependsontheelementtype.Foreacha-list,thefirstcomponentisanintegercodefortheinformationtype,andthesecondistheinformation.

ListFormatforNodes

(-1.elem_code) Elementtypecode(integer).Withnodelists,always1,meaningnodeelement.

(40.resistance) Noderesistance(real).

ListFormatforLinks

(-1.elem_code) Elementtypecode(integer).Withlinklists,always2,meaninglinkelement.

(1.topo_id) TopologyIDofstartnode(real).

Page 464: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(2.topo_id) TopologyIDofendnode(real).

(40.fwd_resist) Forwardresistance(real).

(41.rev_resist) Reverseresistance(real).

(70.link_dir) Linkdirection(integer):-1,0,or1.-1=Reverse0=Bidirectional1=Forward

Page 465: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceelemidNetworkTracingFunctions

ReturnstheIDoftheselectedelement.

(tpm_traceelemidtrace_idtypeindex)

ReturnsanelementID(real)ornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

type Elementtype:1Node2Link

index Elementindex.Thefirstelement'sindexis0

ThisfunctionreturnstheIDoftheelementselected.Usethisfunctiontofindthetraceresultinthesourcetopologyafterperformingatracewithtpm_traceshortortpm_traceflood.

ThisexampleperformsashortpathtraceandgetstheIDofthefirstlinkoftheresultpath.

;opentopologytotrace(setqtpm_id(tpm_acopen"nettopo"nil));createthemodel(setqtrc_id(tpm_tracealloctpm_id));findshortestpath

Page 466: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(tpm_traceshorttrc_idstart_idend_id);numberoflinksinpath(setqqty(tpm_traceqtytrc_id2));getfirstlinkofpath(setqid(tpm_traceelemidtrc_id20))

Page 467: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracefloodNetworkTracingFunctions

Calculatesfloodpaths.

(tpm_tracefloodtrace_idstartmaxres)

ReturnsTornil.

trace_id TracingmodelID,returnedbytpm_tracealloc(real)

start ElementIDofstartnode(real)

maxres Maximumallowedaccumulatedpathresistance(real)

Theaccumulatedresistancevalueisthetotalresistanceofthenodesandlinksthatmakeupthefloodtrace.

Page 468: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracefreeNetworkTracingFunctions

Freesatracingmodel.

(tpm_tracefreetrace_id)

ReturnsTornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

Page 469: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceqtyNetworkTracingFunctions

Countstheselectedelementsafteratrace.

(tpm_traceqtytrace_idtype)

Returnsanelementcount(real)ornil.

trace_id TracingmodelID,returnedbytpm_tracealloc.

type Elementtype(integer):1Node2Link

Page 470: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracesetmaxresNetworkTracingFunctions

Setsmaximumresistancefortheshortestpathalgorithm.

(tpm_tracesetmaxrestrace_idmaxres)

ReturnsTornil.

trace_id TracingmodelID(real),returnedfromtpm_tracealloc

maxres Maximumallowedaccumulatedpathresistance(real)

Thisfunctionsetsanaccumulatedresistancevalueforpathtracing.

Fortheshortestpathtracetosucceed,thetotalcalculatedresistancecannotbegreaterthanthevaluesetforthemaximumresistanceorlessthanthevaluesetfortheminimumresistance.Seetpm_tracesetminres.Seetpm_traceshort.

Page 471: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_tracesetminresNetworkTracingFunctions

Setsminimumresistancefortheshortestpathalgorithm.

(tpm_tracesetminrestrace_idminres)

ReturnsTornil.

trace_id TracingmodelID(real),returnedfromtpm_tracealloc

minres Minimumaccumulatedallowedpathresistance(real)

Thisfunctionsetsanaccumulatedresistancevalueforpathtracing.Fortheshortestpathtracetosucceed,thetotalcalculatedresistancecannotbegreaterthanthevaluesetforthemaximumresistanceorlessthanthevaluesetfortheminimumresistance.Seetpm_tracesetmaxres.Seetpm_traceshort.

Page 472: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceshortNetworkTracingFunctions

Calculatestheshortestpathbetweentwonodes.

(tpm_traceshorttrace_idstartend)

ReturnsTornil.

trace_id TracingmodelID(real),returnedbytpm_tracealloc

start ElementIDofstartnode(real)

end ElementIDofendnode(real)

Fortheshortestpathtracetosucceed,thetotalcalculatedresistancecannotbegreaterthanthevaluesetforthemaximumresistanceorlessthanthevaluesetfortheminimumresistance.Seetpm_tracesetminresandtpm_tracesetmaxres.Theaccumulatedresistancevalueisthetotalresistanceofthenodesandlinksthatmakeuptheshortestpath.

Page 473: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceshortscanNetworkTracingFunctions

GetstheIDofalinkornodeintheshortestpath.

(tpm_traceshortscantrace_idflag)

ReturnsatopologyID(real)ornil.

trace_id TracingmodelID(real),returnedbytpm_tracealloc

flag Pathelementcode(integer):0Currentelement1Firstelement2Lastelement3Nextelement4Previouselement

Firstusetpm_traceshorttocalculateashortestpath.

Page 474: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_traceshortvalNetworkTracingFunctions

Calculatestheresistanceoftheshortestpath.

(tpm_traceshortvaltrace_id)

Returnsaresistance(real)ornil.

trace_id TracingmodelID(real)returnedbytpm_tracealloc

Beforecallingthisfunction,usetpm_traceshorttocalculatetheshortestpath.

Page 475: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_varallocVariablesFunctions

Allocatesasetofconfigurationvariables.

(tpm_varalloc)

ReturnsaconfigurationvariablesID(real)ornil.

Configurationvariablesarecomposedofcleanupvariables,cleanupactionvariables,andtopologyvariables.Thevariablesareinitializedtotheirdefaultvalues.Foralistofthesevariablesandtheirdefaultvalues,seeConfigurationVariables.

Youcanallocatemorethanonesetofconfigurationvariables.

Page 476: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_varfreeVariablesFunctions

Freesasetofconfigurationvariables.

(tpm_varfreevar_id)

ReturnsTornil.

var_id ConfigurationvariablesID(real)

Configurationvariablesarecomposedofcleanupvariables,cleanupactionvariables,andtopologyvariables.Thevariablesareinitializedtotheirdefaultvalues.Foralistofthesevariablesandtheirdefaultvalues,seeConfigurationVariables.

Page 477: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_vargetVariablesFunctions

Getsthevalueofaconfigurationvariable.

(tpm_vargetvar_idvar_name)

Returnsavariablevalueornil.

var_id ConfigurationvariablesID(real)

var_name Variablename(string)

Configurationvariablesarecomposedofcleanupvariables,cleanupactionvariablesandtopologyvariables.Thevariablesareinitializedtotheirdefaultvalues.Foralistofthesevariablesandtheirdefaultvalues,seeConfigurationVariables.

Thefollowingcodeopensatopology,storesthetopology'sconfigurationvaluesinanewsetofvariables,andgetsthevalueofNODE_LAYER.

(setqtpm_id(tpm_acopen"SampleTopo"))(setqvar_id(tpm_varalloc))(tpm_infobuildvartpm_idvar_id)(tpm_acclosetpm_id)(setqnlayer(tpm_vargetvar_id"NODE_LAYER"))

Page 478: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_varlistVariablesFunctions

Getsallthevaluesinaasetofconfigurationvariables.

(tpm_varlistvar_id)

Returnsalistofname-valuepairsornil.

var_id ConfigurationvariablesID(real)

Eacha-listhasthisformat:

(variablename.value)

Configurationvariablesarecomposedofcleanupvariables,cleanupactionvariables,andtopologyvariables.Thevariablesareinitializedtotheirdefaultvalues.Foralistofthesevariablesandtheirdefaultvalues,seeConfigurationVariables.

Page 479: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_varsetVariablesFunctions

Setsthevalueofaconfigurationvariable.

(tpm_varsetvar_idvar_namevar_value)

ReturnsTornil.

var_id ConfigurationvariablesID(real)

var_name Variablename(char)

var_value Variablevalue.

Configurationvariablesarecomposedofcleanupvariables,cleanupactionvariables,andtopologyvariables.Thevariablesareinitializedtotheirdefaultvalues.Foralistofthesevariablesandtheirdefaultvalues,seeConfigurationVariables.

Foranexamplethatshowshowtousetpm_varsetandtpm_varget,seetpm_varget.

Page 480: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AccessFunctions

Thefunctionsforaccessingtopologiesbeginwithtpm_ac.

tpm_acclose

Closesatopology.

tpm_acexist

Checksifatopologyexists.

tpm_acload

Loadsatopologyintomemory.

tpm_acopen

Opensatopology.

tpm_acqty

Countstopologies.

tpm_acunload

Page 481: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Unloadsatopologyfrommemory.

tpm_acupgradeopen

Changesaccessfromreadonlytowrite.

Page 482: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AnalyzingFunctions

Thefunctionsforanalyzingtopologiesbeginwithtpm_ana.

tpm_anabuffer

Createsabufferspacearoundatopology.

tpm_anadissolve

Mergestopologyelementswiththesamevalueinthespecifiedfield.

tpm_anaoverlay

Overlaystwotopologies.

Page 483: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

BuildingandErasingFunctions

Thefunctionsfortopologymaintenancebeginwithtpm_mnt.

tpm_mntbuild

Buildsatopology.

tpm_mnterase

Erasesatopologyfromtheprojectdrawing.

tpm_mntrebuild

Rebuildsatopology.

tpm_mntrename

Renamesatopology.

Page 484: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

CleanupFunctions

Thefunctionsforcleaningtopologyobjectsbeforebuildingthetopologybeginwithtpm_clean.

tpm_cleanactionlistdel

Deletesacleanupactionfromtheactionlist.

tpm_cleanactionlistgetat

Getsthecleanupactionatagivenlistposition.

tpm_cleanactionlistins

Insertsacleanupactionintheactionlist.

tpm_cleanactionlistqty

Getsthenumberofcleanupactionsintheactionlist.

tpm_cleanalloc

Allocatesthecleanupmodel.

tpm_cleananchorss

Page 485: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Getsacleanupmodel'sanchoredentities.

tpm_cleancancel

Cancelsthecleanupprocesswithoutupdatingthedrawing.

tpm_cleancomplete

Testsforanextgrouptobecleaned.

tpm_cleancreatedss

Getscreatedentitiesfollowingacleanupprocess.

tpm_cleanend

Completesthecleanupprocessandupdatesthedrawing.

tpm_cleanerrorcur

Setsthenexterrortocleaninthecurrentgroup.

tpm_cleanerrordraw

Createsatemporarymarkerforthecurrenterror.

tpm_cleanerrorfix

Fixesthecurrenterror.

tpm_cleanerrorget

Page 486: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Getsthecoordinatesofthecurrenterror.

tpm_cleanerrormark

Createsapersistentmarkerforthecurrenterror.

tpm_cleanerrorset

Setsthecoordinatesofanerrorfixpoint.

tpm_cleanfree

Freesthecleanupmodel.

tpm_cleangroupdraw

Createstemporarymarkersforallerrorsofthecurrentgroup.

tpm_cleangroupfix

Fixesallerrorsofthecurrentgroup.

tpm_cleangroupmark

Createspersistentmarkersforallerrorsofthecurrentgroup..

tpm_cleangroupnext

Goestothenexterrorgroup.

tpm_cleangroupqty

Page 487: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Countstheerrorsinthecurrentgroup.

tpm_cleangroupsubtype

Determinesthesubtypeofthecurrentgroup.

tpm_cleangrouptype

Determinesthetypeofthecurrentgroup.

tpm_cleanincludess

Getsacleanupmodel'stargetentities.

tpm_cleaninit

Initializesthecleanupmodel.

tpm_cleaninitanchorset

Specifiesanchoredentitiesforthecleanupmodel.

tpm_cleanmodifiedss

Getschangedentitiesfollowingacleanupprocess.

tpm_cleanprofileload

Loadsadrawingcleanupprofile.

tpm_cleanprofilesave

Page 488: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Savesadrawingcleanupprofile.

tpm_cleanstart

Startsthecleanupprocess.

tpm_cleanunchangedss

Getsunchangedentitiesfollowingacleanupprocess.

Page 489: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

EditingFunctions

Thefunctionsforeditingtopologyelementsbeginwithtpm_edit.

tpm_editaddelem

Addsanelementtoatopology.

tpm_editdelelem

Deletesanelementfromatopology.

tpm_editmodelem

Modifiesatopologyelement.

tpm_editupdelem

Updatesatopologyelement.

Page 490: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ElementInformationFunctions

Thefunctionsformanagingtopologyelementsbeginwithtpm_elem.

tpm_elemadj

Compilesalistofadjacentelements.

tpm_elemfind

Findsanelement.

tpm_elemget

Listsinformationaboutanelement.

tpm_elemid

GetstheIDofanelement.

tpm_elemqty

Countstopologyelements.

tpm_elemss

Page 491: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Createsaselectionsetofelementsofagiventype.

Page 492: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyIteratingFunctions

Thefunctionsforiteratingthroughtopologiesbeginwithtpm_iter.

Manyhavecounterpartsinthetopologyinformationfunctions(tpm_info[xx]).Theiteratingfunctionscanqueryanytopology,loadedorunloaded,openorclosed.Theinformationfunctionsqueryonlytopologiesthatareopen.

tpm_iterdesc

Getsatopologydescription.

tpm_itername

Getsatopologyname.

tpm_iternext

Movestheiteratortothenexttopology.

tpm_iterstart

Createsatopologyiterator.

tpm_iterstop

Page 493: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Freesatopologyiterator.

tpm_itertype

Getsatopologytype.

tpm_iterversion

Getstheversionofatopology.

Page 494: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

NetworkTracingFunctions

Thefunctionsfornetworktracingbeginwithtpm_trace.

tpm_tracealloc

Allocatesatracingmodel.

tpm_tracebestroute

Calculatesthebestround-triproute.

tpm_tracebestroutescan

GetstheelementIDofalinkornodeinthebestroute.

tpm_tracebestrouteval

Calculatestheresistanceofthebestroute.

tpm_traceelemedit

Modifiesatracingelement.

tpm_traceelemget

Page 495: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Getsinformationaboutatracingelement.

tpm_traceelemid

GetsthetopologyIDofatracingelement.

tpm_traceflood

Tracesafloodpathfromaspecifiedpoint.

tpm_tracefree

Freesatracingmodel.

tpm_traceqty

Countstheselectedelementsafteratrace.

tpm_tracesetmaxres

Setsmaximumresistancefortheshortestpathalgorithm.

tpm_tracesetminres

Setsminimumresistancefortheshortestpathalgorithm.

tpm_traceshort

Calculatestheshortestpathbetweentwonodes.

tpm_traceshortscan

Page 496: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

GetsthetopologyIDofalinkornodeintheshortestpath.

tpm_traceshortval

Calculatestheresistanceoftheshortestpath.

Page 497: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyInformationFunctions

Thefunctionsforgettinginformationabouttopologiesbeginwithtpm_info.

Manyhavecounterpartsinthetopologyiteratingfunctions(tpm_iter[xx]).Theinformationfunctionscanqueryonlytopologiesthatareopen.Theiteratingfunctionscanqueryanytopology,loadedorunloaded,openorclosed.

tpm_infobuildvar

Storestheconfigurationvaluesofatopology.

tpm_infocomplete

Testsifatopologyiscomplete.

tpm_infocorrect

Testsifatopologyiscorrect.

tpm_infocurrent

Checksthesourcefromwhichatopologywasloaded.

tpm_infodesc

Page 498: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Getsatopologydescription.

tpm_infomodified

Checksiftopologyelementshavebeenmodifiedusingdrawingtools.

tpm_infoname

Getsatopologyname.

tpm_infostatus

CheckswhetheratopologyisopenforReadorWrite.

tpm_infotype

Getsatopologytype.

tpm_infoversion

Getsatopologyversion.

Page 499: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyQueryFunctions

Thefunctionsforqueryingtopologiesbeginwithtpm_qry.

tpm_qrygetresdesc

Getsthedescriptionofthequeryresulttopology.

tpm_qrygetrestopo

Getsthenameofthequeryresulttopology.

tpm_qrygettoponame

Getsthenameofthequerysourcetopology.

tpm_qrysetrestopo

Definesororundefinesaqueryresulttopology.

tpm_qrysettoponame

Definesorundefinesatopologyquery.

Page 500: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyVariablesFunctions

Thefunctionsformanagingconfigurationvariablesbeginwithtpm_var.

tpm_varalloc

Allocatesasetofconfigurationvariables.

tpm_varfree

Freesasetofconfigurationvariables.

tpm_varget

Getsthevalueofaconfigurationvariable.

tpm_varlist

Getsallthevaluesinasetofconfigurationvariables.

tpm_varset

Setsthevalueofaconfigurationvariable.

Page 501: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

MarkerShapes

Drawingcleanupmarkersareavailableinthefollowingshapes.

ShapeCode Shape

1 Octagon

2 Triangle

3 Rhombus

4 Square

Page 502: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyObjectData

Atopologyisgiventhefollowingsetofobjectdatafieldswhenitisbuilt.Thesefieldscontaininformationabouttheelementsofthetopology.

WarningAlthoughitispossibletouseDataExtensionObjectDatafunctions(ade_od[xx])tomodifythesefields,itisnotagoodideatodoso.Thetopologyfunctionsassumethesefieldsaremanagedbythemalone.

Element FieldName Default

Node ID(int)

Node RESISTANCE(real) 0.0

Link ID(int)

Link START_NODE(int)

Link END_NODE(int)

Link DIRECTION(int) 0(Bidirectional)

Link DIRECT_RESISTANCE(real) Length

Link REVERSE_RESISTANCE(real) Length

Link LEFT_POLYGON(int)

Link RIGHT_POLYGON(int)

Centroid ID(int)

Page 503: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Centroid AREA(real)

Centroid PERIMETER(real)

Centroid LINKS_QTY(int)

ThedefaultresistancevalueLengthisinterpretedasfollows,dependingontheAutoCADentitytype:

Entitytype Length

Line Linelength

Pline Totalplinelength

Arc Calculatedarclength

Circle Calculatedcircumference

Thedefaultlinkdirectionvalueis0(bi-directional).Theotherpossibledirectionvaluesare1(forward),or-1(reverse).Theforwarddirectionforlinesisfromstartpointtoendpoint.Forcirclesandarcs,theforwarddirectioniscounter-clockwise.

Page 504: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

LocationQuery

Thisexampledefinesandexecutesalocationquery.

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"E:\\ADEDWG\\ARCS2.DWG")(ade_dsattach"E:\\ADEDWG\\CIRCLES2.DWG")(ade_dsattach"E:\\ADEDWG\\DONUTS.DWG")(ade_dsattach"E:\\ADEDWG\\MAKE.DWG")(ade_dsattach"E:\\ADEDWG\\POLYLINE.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype1)(ade_qrydefine'("""""""Location"(1)""))(ade_qryexecute)

Page 505: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PropertyQueries

Thefollowingexamplesdefineandexecutepropertyqueries:

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"E:\\ADEDWG\\ARCS2.DWG")(ade_dsattach"E:\\ADEDWG\\CIRCLES2.DWG")(ade_dsattach"E:\\ADEDWG\\DONUTS.DWG")(ade_dsattach"E:\\ADEDWG\\LINES2.DWG")(ade_dsattach"E:\\ADEDWG\\MAKE.DWG")(ade_dsattach"E:\\ADEDWG\\POLYGONS.DWG")(ade_dsattach"E:\\ADEDWG\\POLYLINE.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype2)(ade_qrydefine'("""""""Property"("color""=""5")""))(ade_qryexecute)

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"AUTO:\\AQP5.DWG")(ade_dsattach"AUTO:\\AQP5A.DWG")(ade_dsattach"AUTO:\\MAKE.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)

Page 506: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_qrysettype"draw")(ade_qrydefine'("""""""Property"("objtype""=""SPLINE")""))(ade_qrydefine'("OR""""""Property"("objtype""=""ELLIPSE")""))(ade_qryexecute)

Page 507: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

LocationQuerywithPropertyAlteration

Thisexampledefinesandexecutesalocationquerywithpropertyalteration.

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"E:\\ADEDWG\\AQFA3.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype"draw")(ade_qrydefine'("""""""Location"("all")""))(ade_altpclear)(ade_altpdefine"Height""2")(ade_altpdefine"Style""Y")(ade_altpdefine"TextValue""test")(ade_altpdefine"Layer""newlyr")(ade_altpdefine"Rotation""0.5")(ade_altpdefine"Color""blue")(ade_qryexecute)

Page 508: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

LocationQuerywithPropertyAlteration:BeforeandAfter

Thisexampleshowstwoversionsofapropertyalterationquery.Thesecondexampleisaneditedversionofthefirst.Notehowchangestotheargumentsintheade_altpdefinecallscausedifferentpropertyalterationeffects.

OriginalVersion

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"E:\\ADEDWG\\ARCS2.DWG")(ade_dsattach"E:\\ADEDWG\\CIRCLES2.DWG")(ade_dsattach"E:\\ADEDWG\\DONUTS.DWG")(ade_dsattach"E:\\ADEDWG\\ESPMR.DWG")(ade_dsattach"E:\\ADEDWG\\LINES2.DWG")(ade_dsattach"E:\\ADEDWG\\POLYGONS.DWG")(ade_dsattach"E:\\ADEDWG\\POLYLINE.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype"draw")(ade_qrydefine'("""""""Location"("all")""));ade_altpdefinecalls(ade_altpdefine"Color""5")(ade_altpdefine"Layer""NEWLYR")(ade_altpdefine"Elevation""-2")(ade_altpdefine"Thickness""1.5")(ade_altpdefine"Linetype""CENTER")

Page 509: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(ade_qryexecute)

EditedVersion

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(ade_dsattach"E:\\ADEDWG\\ARCS2.DWG")(ade_dsattach"E:\\ADEDWG\\CIRCLES2.DWG")(ade_dsattach"E:\\ADEDWG\\DONUTS.DWG")(ade_dsattach"E:\\ADEDWG\\ESPMR.DWG")(ade_dsattach"E:\\ADEDWG\\LINES2.DWG")(ade_dsattach"E:\\ADEDWG\\POLYGONS.DWG")(ade_dsattach"E:\\ADEDWG\\POLYLINE.DWG")(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype"draw")(ade_qrydefine'("""""""Location"("all")""));changesinade_altpdefinecalls(ade_altpdefine"Color""BLUE")(ade_altpdefine"Layer""XYZ")(ade_altpdefine"Elevation""7")(ade_altpdefine"Thickness""1.5")(ade_altpdefine"Linetype""CENTER")(ade_qryexecute)

Page 510: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ComplexQuery

Thefollowingquerydefinitioncombinesalocationbufferfenceconditionandapropertyconditionwitharangetabledefinition,andpropertyalterationisperformedonthequeryresult.

(mapcar'ade_dwgdeactivate(ade_dslist))(setqade_tmpprefval(ade_prefgetval"ActivateDwgsOnAttach"))(ade_prefsetval"ActivateDwgsOnAttach"T)(setqdwg_id(ade_dsattach"E:\\ADEDWG\\POPS.DWG"))(ade_prefsetval"ActivateDwgsOnAttach"ade_tmpprefval)(ade_qryclear)(ade_qrysettype"draw");locationbufferfence(ade_qrydefine'("""""""Location"("bufferfence""inside"3.000000(4.4262177.9913790.000000)(2.3850545.5307880.000000)(4.6480833.9125620.000000)(5.9127165.7081280.000000)(7.7542003.8238920.000000)(8.0204393.6465520.000000))""))(ade_qrydefine'("OR""""""Property"("objtype""=""ARC,CIRCLE")""));rangetable(ade_rtdefrange"Rtable""Rangetabledependinguponobjecttype"'(("=""CIRCLE""LAYER-CIRCLE")("=""ARC""LAYER-ARC")

Page 511: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

("OTHERWISE""""LAYER-OTHERS")))(ade_altpclear)(ade_altpdefine"Layer""(Range.TYPERtable)")(ade_altpdefine"Color""YELLOW")(ade_qryexecute)

Page 512: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

TopologyIDs

TopologyfunctiondocumentationusesanumberofdifferentkindsofIDs,aslistedinthefollowingtable.

AlthoughtheseIDsareallthesametype,ade_id,wegivethemdifferentnamesinthedocumentationaccordingtotheirpurpose.

Type Name Identifies UsedorReturnedBy

ade_id clean_id Acleanupmodel tpm_clean[xx]

ade_id elem_id Atopologyelement tpm_editdelelemtpm_editmodelemtpm_elemadjtpm_elemgettpm_traceelemedittpm_traceelemget

ade_id iter_id Atopologyiterator tpm_iter[xx]

ade_id overlay_id Anoverlaytopology tpm_anaoverlay

ade_id source_id Asourcetopology tpm_anabuffertpm_anadissolvetpm_anaoverlay

ade_id tpm_id Atopology tpm_acclosetpm_acopen

Page 513: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

tpm_acupgradeopentpm_editaddelemtpm_editdelelemtpm_editmodelemtpm_elemadjtpm_elemfindtpm_elemgettpm_elemidtpm_elemqtytpm_elemsstpm_info[xx]tpm_mntbuildtpm_mntrebuildtpm_tracealloctpm_traceelemgetmap_topoAuditmap_topoStat

ade_id trace_id Atracingmodel tpm_trace[xx]

ade_id var_idclean_var_idact_var_id

ConfigurationvariablesTopologyvariablesCleanupvariablesCleanupactionvariables

tpm_anabuffertpm_anadissolvetpm_anaoverlaytpm_clean[xx]tpm_infobuildvartpm_mntbuildtpm_var[xx]

Page 514: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

LocationExpressions

Locationexpressionsareusedasquerycondargumentsinade_querydefinecallsthatdefineLocationconditions.

ThereareanumberofformatstochoosefromwhenwritingLocationexpressions.Theyarelistedbelow.TheformattousedependsontheLocationtype,whichisidentifiedineachofthefollowingformatsbythefirstargument.Theotherargumentsaredescribedbelow.

Location-All

("all")

Location-Bufferfence

("bufferfence"searchtypeoffsetpt1pt2...ptN)

Location-Circle

("circle"searchtypecenterptradius)

Location-Fence

("fence"pt1pt2...ptN)

Page 515: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Location-Point

("point"pt)

Location-Polygon

("polygon"searchtypept1pt2...ptN)

Location-Polyline-Bufferfence

("polyline""bufferfence"searchtypeoffsetename)

Location-Polyline-Fence

("polyline""fence"ename)

Location-Polyline-Polygon

("polyline""polygon"searchtypeename)

Location-Window

("window"searchtypept1pt2)

LocationExpressionParameters

searchtype Searchtypekeyword(string):"inside"or"crossing".

offset Bufferoffsetdistance(real).

Page 516: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ename AutoCADentityname,orasetofpoints,or"?".If"?",whenthequeryexecutes,itpromptstheusertoclickasetofpoints.

ptptNcenterpt A2Dor3Dpoint(alistofreals).Ifa3Dpoint,theZcoordinateisignored.

radius Radius(real).

LocationExamples

ThefollowingexamplesdefineLocationconditions.ThefirstisaLocation-Allcondition:

(ade_qrydefine'("AND""(""NOT""Location"("All")""))

ThesecondisaLocation-Windowcondition:

(ade_qrydefine'("AND""""""Location"("window""crossing"(1.02.0)(3.04.0))""))

AndthethirdisaLocation-Polylinecondition.

(ade_qrydefine(list"AND""(""""Location"(list"polyline""bufferfence""inside"20.0(entlast))""))

Page 517: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ThefollowingthreeexamplesofLocation-Polylineconditionsspecifytheenameargumentindifferentways.Thefirstsuppliesanentityname:

(ade_qrydefine(list"""""""Location"(list"polyline""polygon""crossing"(entlast))""))

Thesecondsuppliesasetofpoints:

(ade_qrydefine'("""""""Location"("polyline""polygon""crossing"(

1;1=Polylineopen,0=Polylineclosed

(001);Directionofnormalvector:;(001)identifiestheZaxis,;i.e.,thispolygonisparallelto;theXYplane

0.000000;Bulgefactorofavertex(4.4262177.9913790.000000);Coordinatesofavertex

0.000000(2.3850545.5307880.000000)

0.000000(4.6480833.9125620.000000)

0.000000(5.9127165.7081280.000000)

0.000000

Page 518: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

(7.7542003.8238920.000000)

0.000000(8.0204393.6465520.000000)))""))

Andthethirdpromptstheusertoclickasetofpoints:

(ade_qrydefine'("""""""Location"("polyline""polygon""crossing""?")""))

Page 519: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

SQLExpressions

SQLexpressionsareusedasquerycondargumentsinade_querydefinecallsthatdefineSQLconditions.

Theyhavethefollowingformat:

(linkpathnamesqlcondition)

SQLExpressionParameters

linkpathname Linktemplate(string).

sqlcondition SQLcondition(string).

ThesqlconditionargumentshouldcontainonlytheWHEREclauseofanSQLstatement(forexample,"last_name='Smith'").Toselecttheentiretable,letthesqlconditionargumentbetheemptystring("").

(ade_qrydefine'("AND""""""Sql"("EMPLN3""")""))

Page 520: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

ObjectDataFieldTypes

Thedatatypesforobjectdatafieldsareasfollows.Thetypenamesinthefirstcolumnarethecoltypeargumentsforuseinfielddefinitions.

Type Description

integer From–2,147,483,648through2,147,483,647

character Anyalphanumericstring,includingtheemptystring,""

point Listofthreerealnumbers,separatedbycommas,thatrepresentapointwithanX,Y,andZvalue,enclosedinquotes(astringvalue)

real From–1.7E308through+1.7E308

Page 521: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

AddingFieldstoaTable

Thefollowingsampleaddsonefieldofeachdatatypetoanexistingtable.

;Definenewfields(setqnewfields'("columns";Defineacharacterfield(("colname"."NEWFIELD1")("coldesc"."NewField1Description")("coltype"."character")("defaultval"."DefaultValue"));Defineanintegerfield(("colname"."NEWFIELD2")("coldesc"."NewField2Description")("coltype"."integer")("defaultval".1));Defineapointfield(("colname"."NEWFIELD3")("coldesc"."NewField3Description")("coltype"."point")("defaultval"."4.426217,7.991379,1.726213"));Definearealfield(("colname"."NEWFIELD4")("coldesc"."NewField4Description")("coltype"."real")("defaultval".1.2345))));Addnewfieldstoexistingtable(ade_odaddfield"OLDTABLE"newfields);

Page 522: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

RangeTableOperators

Youcanusethefollowingcomparisonoperatorsinrangetableexpressions:

<><=>=/=otherwise

Whenthefirstelementintherangeexpressionis"otherwise",thesecondelementmustbetheemptystring("").Forexample:("otherwise""""red").Althoughyoudonotspecifyacomparisonvaluewhenyouusetheotherwiseoperator,asecondlistelementisstillrequired.

NoteThenot-equaloperator,representedhereby"/=",isrepresentedby"<>"inotherDataExtensionfunctions.

Page 523: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

FunctionsthatReturnSelectionSets

Thefollowingfunctionsreturnselectionsets.

tpm_elemssade_editlockedade_editnewade_editlockederasedmap_dwgbreakobjmap_dwgtrimobjmap_topoclosemap_topocomplete

Page 524: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

PlotSetAttributes

Thistableshowsplotsetattributenames,descriptions,examples,anddefaultvalues.

Attribute Description Default

name Queryname(string),e.g.,"plotset2" ""

desc Description(string),e.g.,"CompletePlotSet" ""

pnam Plottername(string),e.g.,"HPLaserJetIIIonLPT1"

""

pscr Plotscript(string),e.g.,"e,n,y" ""

block Nameofplotlayout,ablockname(string),e.g.,"TBLOCK"

""

atts Listofattributesfortheblock(stringlist),e.g.,"TITLE"

nil

vlayer Mainviewportlayer(string),e.g.,"VPORT2" ""

vdispl Layerstodisableforthemainviewport(stringlist),e.g.,"0"

nil

kflg Enablesthereferenceviewport:TornilTEnablednilDisabled

T

Page 525: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Notethattherearetwodependentattributes,"klayer"and"kdispl"

klayer Keyviewportlayer(string),e.g.,"VPORT1",thelayerofthereferenceviewport,whichmustbeadifferentlayerfromthelayerusedforthemainviewport(attribute"vlayer");ifthefunctionmap_pltblkvpsreturnsonlyoneviewportlayer,itshouldbeusedforthemainviewport

""

kdispl Keydisplaylayers(stringlist),e.g.,"BOUNDARY",alistoflayerstobedisplayedinthereferencedviewport.Thisshouldnotbenilif"kflg"isenabled.Validlayersareallthelayersreturnedbyade_dsproplistusingtheoption"layer"

nil

kscl Keyviewportscalefactor(real) 0.25

dwgs Listofsourcedrawings(stringlist),e.g.,"DRAWING1.DWG""DRAWING2.DWG"

nil

dact Forcedrawingactiveatplottime:Tornil T

qcat Listofquerycatalogs(stringlist),pairedwithqnamlistentries,e.g.,"Queries"

nil

qnam Listofquerynames(stringlist),pairedwithqcatlistentries,e.g.,"Query_One"

nil

bdwg Boundarydrawing(string),e.g.,"BOUNDARY.DWG"

""

bnds Boundaries(stringlist),theboundaryorboundariestousebyprovidingthevalueforthefieldassignedin"bnamf",e.g.,"Boundary#3"

nil

blyr Boundarylayer(string),thenameofthelayertheboundaryisplacedon.Itcanbeanylayerofthe

""

Page 526: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

boundarydrawing.Forexample,"BOUNDARY"

bnamt Boundarynametable(string),thenameoftheobjectdatatableattachedtotheboundaryobject,e.g.,"BOUNDARIES"

""

bnamf Boundarynamefield(string),thenameofthefieldtouse(fromthetableassignedin"bnamt")forthe"bnds"attribute,e.g.,"name"

""

bodfs Boundaryfields(stringlist),thelistoffieldnamestobemappedtoattributesinthetitleblock,e.g.,"name"(seedetailsandexamplefollowingthistable);thetitleblockisassignedusingtheattributesfromtheblockassignedin"block"

nil

sflg Plottospecifiedscale:Tornil nil

scale Plotscale(string),e.g.,"1:2000" 1:1

clip Clipobjectsagainstboundary(flag):Tornil

nil

pbnd Plotboundary(flag):TornilTPlotboundarypolylinesareplottednilPlotboundarypolylinesareerasedbeforeplotting

nil

bbuf Bufferboundary:Tornil nil

btyp Buffertype:"true"or"rect""true"Offsetstheminimumboundingrectangleforamapboundarypolyline"rect"Specifiesanoffsetofanexistingplotboundaryline

true

bdist Bufferdistance(real) 0.10

Page 527: AutoCAD Map 3D 2009 AutoLISP Reference - … Map 3D 2009 AutoLISP Reference ... , map plotting, and topology. ... Click "Developer Center - ObjectARX for Autodesk Map 3D". 4

Mappingofobjectdatafieldstoblockattributesismanagedbythetwoplotattributes"bodfs"and"atts".Themappingisbestexplainedbyexample.Supposethefollowingconditions:

Theboundaryobjectdatatable,definedbythe"bnamf"attribute,hasthefollowingfields:Field1,Field2,Field3,andField4.

Thelayoutblock,definedbythe"block"attribute,hasthefollowingattributes:Attr1,Attr2,Attr3,Attr4,andAttr5.YouwantthevalueofField1toappearinplaceofAttr2,thevalueofField2inplaceofAttr3,andvalueofField4inplaceofAttr1.

Todefinethedesiredmapping,setthe"bodfs"attributeto("field1""field2""field4")andthe"atts"attributeto("attr2""attr3""attr1").Whenplottingisdone,valuesofthefieldsfromtheobjectdatatableattachedtotheboundary'sclosedpolylinewillbeassignedtothespecifiedblockattributes.Thenumberofelementsineachlistfor"bodfs"and"atts"mustbethesame.