less than or equalautolisp functions

797
< (less than), < (less than), less than operator, operators:\<= (less than or equal to), <= (less than or equal to), less than or equal to operator, mathematical functions:less than or equal to, operators:> (greater than), > (greater than), greater than operator, mathematical functions:greater than, operators:>= (greater than or equal to), >= (greater than or equal to), greater than or equal to operator, operators:~ (bitwise NOT), bitwise NOT operator, ~ (bitwise NOT), mathematical functions:bitwise NOT, operators:1+ (increment), 1+ (increment), increment operator, incrementing numbers, numbers:incrementing, operators:1- (decrement), decrement operator, 1- (decrement), decrementing numbers, numbers:decrementing, absolute values, numbers:absolute values of, color selection dialog box, displaying, dialog boxes:color selection, Help: invoking, acad-pop-dbmod function, DBMOD system variable:restoring value stored with acad-push-dbmod, acapp.arx file, DBMOD system variable:storing current value, acad-push-dbmod function, acapp.arx file, sorting:strings, strings:alphabetizing list of, color selection dialog box, displaying, dialog boxes:color selection, color selection dialog box, displaying, dialog boxes:color selection, associative dimensions, dimensions:associative, LAYERPMODE setting, layers:tracking changes to, acet-layerp-mode function, LAYERPMODE setting, layers:tracking changes to, acet-layerp-mark function, Layer Translator, AutoLISP function for, layers:converting to standard settings, acet-laytrans function, model space units:converting to paper space units, paper space units:converting model space units to, converting:model space units to paper space units, Layer Translator, AutoLISP function for, layers:converting to standard settings, acet-laytrans function, paper space units:converting to model space units, model space units:converting paper space units to, converting:paper space units to model space units, Layer Translator, AutoLISP function for, layers:converting to standard settings, acet-laytrans function, user input:selecting tiles, tiles:selecting in dialog boxes, dialog boxes:specifying tiles, strings:adding/modifying in a dialog box list, dialog boxes:modifying strings in active list, dialog boxes:adding strings to active list, strings:adding inactive dialog box lists, modifying, strings in active dialog box lists, dialog boxes:for error messages, dialog boxes:warning message, warning message, in dialog boxes, error messages:displaying in dialog boxes, expand function, setting segment size for, allocating memory, memory:setting segment size, segments, setting size of, logical AND, mathematical functions:AND, angles:defined by two endpoints, endpoints:angle returned from, lines:angle of, in radians, strings:converting:from angle to radians, radians:converting strings to, angles:converting from string to radian, converting:angles to radians, real values:converting angles from radians to, floating point values:converting angles

Upload: others

Post on 11-Apr-2020

17 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: less than or equalAutoLISP Functions

<(lessthan),<(lessthan),lessthanoperator,operators:\<=(lessthanorequalto),<=(lessthanorequalto),lessthanorequaltooperator,mathematicalfunctions:lessthanorequalto,operators:>(greaterthan),>(greaterthan),greaterthanoperator,mathematicalfunctions:greaterthan,operators:>=(greaterthanorequalto),>=(greaterthanorequalto),greaterthanorequaltooperator,operators:~(bitwiseNOT),bitwiseNOToperator,~(bitwiseNOT),mathematicalfunctions:bitwiseNOT,operators:1+(increment),1+(increment),incrementoperator,incrementingnumbers,numbers:incrementing,operators:1-(decrement),decrementoperator,1-(decrement),decrementingnumbers,numbers:decrementing,absolutevalues,numbers:absolutevaluesof,colorselectiondialogbox,displaying,dialogboxes:colorselection,Help:invoking,acad-pop-dbmodfunction,DBMODsystemvariable:restoringvaluestoredwithacad-push-dbmod,acapp.arxfile,DBMODsystemvariable:storingcurrentvalue,acad-push-dbmodfunction,acapp.arxfile,sorting:strings,strings:alphabetizinglistof,colorselectiondialogbox,displaying,dialogboxes:colorselection,colorselectiondialogbox,displaying,dialogboxes:colorselection,associativedimensions,dimensions:associative,LAYERPMODEsetting,layers:trackingchangesto,acet-layerp-modefunction,LAYERPMODEsetting,layers:trackingchangesto,acet-layerp-markfunction,LayerTranslator,AutoLISPfunctionfor,layers:convertingtostandardsettings,acet-laytransfunction,modelspaceunits:convertingtopaperspaceunits,paperspaceunits:convertingmodelspaceunitsto,converting:modelspaceunitstopaperspaceunits,LayerTranslator,AutoLISPfunctionfor,layers:convertingtostandardsettings,acet-laytransfunction,paperspaceunits:convertingtomodelspaceunits,modelspaceunits:convertingpaperspaceunitsto,converting:paperspaceunitstomodelspaceunits,LayerTranslator,AutoLISPfunctionfor,layers:convertingtostandardsettings,acet-laytransfunction,userinput:selectingtiles,tiles:selectingindialogboxes,dialogboxes:specifyingtiles,strings:adding/modifyinginadialogboxlist,dialogboxes:modifyingstringsinactivelist,dialogboxes:addingstringstoactivelist,strings:addinginactivedialogboxlists,modifying,stringsinactivedialogboxlists,dialogboxes:forerrormessages,dialogboxes:warningmessage,warningmessage,indialogboxes,errormessages:displayingindialogboxes,expandfunction,settingsegmentsizefor,allocatingmemory,memory:settingsegmentsize,segments,settingsizeof,logicalAND,mathematicalfunctions:AND,angles:definedbytwoendpoints,endpoints:anglereturnedfrom,lines:angleof,inradians,strings:converting:fromangletoradians,radians:convertingstringsto,angles:convertingfromstringtoradian,converting:anglestoradians,realvalues:convertinganglesfromradiansto,floatingpointvalues:convertingangles

Page 2: less than or equalAutoLISP Functions

fromstringsto,strings:converting:angularvalueinradiansto,radians:convertingtostrings,angles:convertingtostrings,lists:concatenating,appendinglists,lists:appendingto,lists:constructing,concatenating:lists,lists:passingtofunctions,functions:executing,ARXapplications.SeeObjectARXapplications,ObjectARXapplications:listingloadedapplications,ObjectARXapplications,applications:ObjectARX,listing,application-handlingfunctions,ObjectARX,ObjectARXapplications:loading,applications:loadingObjectARX,ObjectARXapplications:unloading,applications:unloadingObjectARX,charactercodes:ASCII.SeeASCIIcharactercodes,ASCIIcharactercodes:convertingfirstcharacter,associationlists,radians:arctangentsmeasuredin,arctangents,measuredinradians,strings:converting:torealnumbers,converting:strings:torealnumbers,realnumbers:convertingfromstrings,converting:strings:tointegers,integers:convertingfromstrings,atoms,atoms:verifying,symbols:definingcurrentatomslist,automaticloading:ofObjectARXfiles,ObjectARXapplications:loadingassociatedfiles,loadingfiles:forObjectARXcommands,automaticloading:ofAutoLISPfiles,loadingfiles:forAutoLISPcommands,bitwiseBooleanfunctions,functions:Boolean,bitwise,Booleanbitwisefunctions,values:boundtosymbols,symbols:valueboundto,elements:thirdofalist,lists:thirdelement,obtainingZcoordinate,Zcoordinate,obtaining,points:Zcoordinate,elements:secondofalist,lists:secondelement,obtainingYcoordinate,Ycoordinate,obtaining,points:Ycoordinate,elements:firstofalist,lists:firstelement:obtaining,elements:allbutfirstofalist,lists:firstelement:excluding,integers:convertingtostrings,ASCIIcharactercodes:convertingtosinglecharacters,tiles:managingdataindialogboxes,files:closing,closing:files,AutoCADcommands:executing,commands:executinginAutoCAD,executingAutoCADcommands,SKETCHcommand,SCRIPTcommand,conditionalfunctions,primary,evaluatinglists,primarycondition,lists:evaluatingprimaryconditions,elements:addingtobeginningoflist,dottedlists:constructing,lists:addingfirstelement,lists:constructingdottedlists,cosineofangles,angles:measuringcosineinradians,values:convertingtootherunitsofmeasurement,unitsofmeasurement,convertingvaluesand,measurements,convertingvalues,converting:values,tootherunitsofmeasurement,functions:defining,functions:built-in,built-infunctions,functions:definedinlists,liststructureoffunctions,displaying,functions:displayingliststructures,defun-q,displayingdefinedfunction,functions:definedinlists:settingsymbolsas,symbols:settingasfunctions,objects:nongraphical:addingtodictionaries,nongraphicalobjects,addingtodictionaries,dictionaries:addingnongraphicalobjects,dictionaries:findingnextitem,dictionaries:removingentries,renaming:dictionaryentries,

Page 3: less than or equalAutoLISP Functions

dictionaries:renamingentries,searching:dictionaries,dictionaries:searchingitems,widthoftiles,retrievingindialogboxunits,tiles:widthsof,heightoftiles,retrievingindialogboxunits,tiles:heightsof,distance:betweenpoints,3Ddistance:betweenpoints,realvalues:convertingfloatingpointvaluesto,converting:floatingpointtorealvalues,floatingpointvalues:convertingtorealvalues,realnumbers:convertingfromfloatingpoint,closing:dialogboxes,dialogboxes:terminating,dialogboxes:closing,terminatingdialogboxes,dialogboxes:closing,closing:dialogboxes,images:endingcreationindialogboxes,dialogboxes:endingcreationofimages,dialogboxes:endingactivelists,deleting:entities,objects:deleting,entities:deleting,objects:restoringdeletedobjects,entities:restoringdeletedentities,deleting:objects,entities:undeleting,entities:deleting,undeletingobjects,objects:undeleting,objects:deleting,removing.Seedeleting,definitiondata:retrieving,definitions,retrievingdataforobjects,entities:retrievingdefinitiondata,objects:retrievingdefinitiondata,entities:naming,nondeletedlastobject,returningnameof,entities:lastnondeleted,drawings:lastnondeletedobject,objects:lastnondeleted,objects:naming,names:ofobjects,returning,entities:creating:indrawings,objects:creatingindrawings,VIEWPORTentitytype:creating,names:ofobjects,returning,entities:handlesand,handles:fornewobjects,entities:creating,objects:creating,entities:assigninghandles,objects:assigninghandles,entities:naming,objects:naming,naming:objects,definitiondata:modifying,objects:modifyingdefinitiondata,entities:modifyingdefinitiondata,VIEWPORTentitytype:changing,numbers:Seealsorealnumbers,namespaces:Seealsoseparate-namespaceVLX,entities:naming,names:ofobjects,returning,entities:returningnextdrawingentity,objects:returningnextdrawingobject,objects:naming,names:ofobjects,returning,editorreactors:Seealsoreactors,selectingobjects,entities:selecting,objects:selecting,ObjectSnapmode,screenimages,updating,entities:updatingonscreen,images:updatingofscreen,polylines:updatingscreenimage,objects:updatingscreenimage,blockreferences:withattributes:updatingscreenimage,blockreferences:withattributes:changing,screens:updatingobjectimage,REGENcommand,objects:nested,nestedentities,entities:nested,equalitybetweenexpressions,expressions:determiningwhetheridentical,mathematicalfunctions:equalitychecking,mathematicalfunctions:equalitychecking,expressions:determiningwhetherequal,equalitybetweenexpressions,user-definableerror-handlingfunction,errorhandling:user-definedfunction,functions:error-handling,errormessages:user-defined,evaluatingexpressions:usingEVALfunction,evaluatingexpressions,closing:applications,forcedquit,applications:quitting,quit/exitaborterrormessage,antilogarithms,andrealnumbers,allocatingmemory,

Page 4: less than or equalAutoLISP Functions

memory:allocating,mathematicalfunctions:exponentiation,exponents,specifyingpower,filledrectangles,drawingindialogbox,rectangles:filled,rectangles:indialogboximagetiles,searching:AutoCADlibrarypath,librarypaths,searchingforfiles,files:searchinglibrarypathsfor,find.Seesearch,converting:numbers,integers:convertingfromrealnumbers,realnumbers:convertingtosmallerintegers,truncatingnumbers,numbers:convertingtorealnumbers,realnumbers:convertingfromnumbers,expressions:evaluating:forallmembersofalist,evaluatingexpressions:forallmembersofalist,optimizingargumentswithVisualLISPcompiler,linkingargumentswithVisualLISPcompiler,VisualLISP:linkingandoptimizingarguments,freeingmemory,garbagecollection,memory:freeingunused,integers:greatestcommondenominator,commondenominators,findinggreatest,numbers:commondenominators,dialogboxes:retrievingDCLvaluesofattributes,DCLvalues,retrieving,dialogboxes:attributeswithDCLvalues,attributes:retrievingDCLvalues,runtimevaluesofdialogboxtiles,retrieving,dialogboxes:retrievingruntimevaluesoftiles,tiles:runtimevaluesof,angles:userinputof,angles:measuredinradians,radians:ofangles,application-specificdata:fromacad.cfgfile,retrieving,acad.cfg,AppDatasection,files:acad.cfg,AutoCADcommands:retrievinglocalizednamesof,naming:commandsinAutoCAD,commands:localizednameinAutoCAD,commands:EnglishnameinAutoCAD,rectangles:corners,pausingforuserinput,corners,userinputforrectangles,distance:pausingforuserinputof,3Ddistance:specifying,distance:specifyingpoints,basepoints,specifyingdistance,environmentvariables:returningvalueof,environmentvariables:defined,systemvariables:environmentvariablenames,dialogboxes:forfileselection,filenames:promptinguserfor,naming:files:withAutoCADfiledialogbox,filenames:userinput,integers:pausingforuserinputof,userinput:integers,integers:limitsforuserinput,integers:rangeofvalues,userinput:keywords,keywords:userinput,angles:inradians,userinput:angles,points:pausingforuserinputof,userinput:points,points:specifying,realnumbers:pausingforuserinputof,userinput:realnumbers,realnumbers:specifying,strings:pausingforuserinputof,userinput:strings,strings:specifying,systemvariables:retrievingvaluesof,systemvariables:Seealsoenvironmentvariables,screens:graphicsforAutoCAD,AutoCADgraphicsscreen,viewports:clearingcurrent,vectors:drawinginviewports,viewports:vectors,drawing,inputdevices,readingfromAutoCAD,reading,AutoCADinputdevices,text:inscreenmenus,AutoCADstatusline,writingtextto,statusline,writingtextto,text:onAutoCADstatusline,screenmenus,enteringtextin,transformationmatrix:vectors,graphicsvectors:drawing,multiplevectors,ongraphicsscreen,

Page 5: less than or equalAutoLISP Functions

vectors:drawingongraphicsscreen,viewports:drawingvectors,handles:returningobjectnamesby,objects:handlesand,entities:handlesand,Help:invoking,conditionallyevaluatingexpressions,expressions:evaluating:withif,evaluatingexpressions:conditionally(if...),forcingdisplayofdialogboxes,dialogboxes:forcingdisplayof,userinput:keywords:forfunctioncalls,keywords:foruser-inputfunctioncalls,functioncalls,keywords,userinput:restrictingtypeof,input,restrictingusers,keywords:methodsforabbreviating,intersections,oflines,lines:determiningintersections,strings:converting:integersto,converting:integerstostrings,integers:convertingtostrings,anonymousfunctions,defining,functions:anonymous,lists:lastelementin,elements:lastinalist,layouts,paperspace,drawings:paperspacelayouts,paperspace,currentlayoutsin,layerstate-addlayers,addlayers,add,layerstate,layerstate-delete,delete,layerstate,layerstate-export,export,layerstate,layerstate-getlayers,getlayers,layerstate,layerstate-has,has,layerstate,layerstate-import,import,layerstate,layerstate-rename,rename,layerstate,layerstate-restore,restore,layerstate,layerstate-save,save,layerstate,lists:numberofelementsin,lists:quantityofelements,elements:quantityinlists,lists:constructing,concatenating:expressionsintolists,expressions:concatenating,verification:oflists,lists:verifying,expressions:evaluating,evaluatingexpressions,recursion,inloadingfiles,files:loading,loadingfiles:recursion,files:loading:DCLfiles,loadingfiles:DCLfiles,DCLfiles:loading,realnumbers:andnaturallogs,logs,naturallogsofnumbers,logicalbitwiseAND,AND,listofintegers,integers:listusingbitwiseAND,logicalbitwiseOR,integers:listusingbitwiseOR,logicalbitwiseshiftofinteger,integers:shiftingbyspecifyingbits,bits,specifyingtoshiftintegers,elements:supplyingasargumentsforlists,lists:suppliedargumentsand,numbers:largest,largestnumbers,integers:largestinlist,realnumbers:largestinlist,memory:dynamic,memory:statusinAutoLISP,dynamicmemory,expressions:searchingfor,searching:lists:forremainder,lists:remainder,obtaining,lists:searchingforremainder,menus:itemstatus,statusofmenuitems,commands:formenus,menucommands,issuing,DIESELmenuexpressions,menus:DIESELexpressions,verification:ofloadedmenugroups,loading:menugroups,menugroups,loading,numbers:smallest,smallestnumbers,realnumbers:smallestinlist,integers:smallestinlist,verification:ofnegativenumbers,numbers:negative,verifying,negativenumbers,verifying,dialogboxes:tilemode,setting,tiles:modefordialogboxes,namedobjectdictionary,entitynameof,dictionaries:namedobject,dictionaries:accessingobjects,dictionaries:namedobject,objects:nongraphical:accessing,entities:nongraphical,accessing,WorldCoordinateSystem:transformingentitydefinitiondatapoints

Page 6: less than or equalAutoLISP Functions

to,entities:selecting,complexobjects,accessingdefinitiondata,objects:complex,objects:selecting,selectingobjects,definitiondata:ofcomplexobjects,entities:complex,polylines:definitiondata,blockreferences:selecting,blockreferences:definitiondata,polylines:selecting,blockreferences:attributes,selecting,ModeltoWorldTransformationMatrix,coordinatesystems:transforming,points:transformingcoordinatesystems,WCS.SeeWorldCoordinateSystem,MCS.SeeModelCoordinateSystem,ModelCoordinateSystem(MCS),blocks:nested,complexobjects,accessingdefinitiondata,objects:selecting,definitiondata:ofcomplexobjects,userinput:selectingobjectswithoutuserinput,dialogboxes:displaying,dialogboxes:adding,verification:ofnilevaluation,symbols:determiningifnil,nil:checkingvariablefor,nthelementofalist,lists:nthelementof,elements:nthelementoflists,verification:ofnilevaluation,symbols:determiningifnil,nil:checkingvariablefor,verification:ofrealnumbersorintegers,variables:determiningifnumeric,integers:verifying,realnumbers:verifying,accessingfileswithAutoLISP,files:opening,openingfiles,functions:AutoLISPI/O,logicalORofexpression,lists:usingOR,points:3D,3DObjectSnapmode,ObjectSnapmode:specifyingpoints,UCS.Seeusercoordinatesystem,usercoordinatesystem,3Dpoints,3Dpoints:angles,specifying,3Dpoints:inusercoordinatesystem,writing:expressionstofiles,commandline:printingexpressionsto,expressions:printingtocommandline,expressions:writingtofiles,files:writingexpressionsto,backslash,controlcodes(table),writing:expressionstofiles,commandline:printingexpressionsto,expressions:printingtocommandline,expressions:writingtofiles,files:writingexpressionsto,writing:expressionstofiles,commandline:printingexpressionsto,expressions:printingtocommandline,expressions:writingtofiles,files:writingexpressionsto,expressions:evaluating:sequentially,expressions:lastevaluated,evaluatingexpressions:sequentially,strings:displayinginpromptarea,screens:dual-screendisplay,screens:displayingmessages,errormessages:forquittingapplications,forcinganapplicationtoquit,applications:forcingtoquit,quittingapplications,forcing,expressions:returningwithoutevaluating,evaluatingexpressions:noevaluation,atoms:firstinastring,converting,firstlistoratomfromastring,delimiters,inmultipleexpressions,lists:firstexpression,converting,converting:expressions,keyboardinputbuffer:returningASCIIcodefrom,files:returningASCIIcodefrom,ASCIIcharactercodes:inopenfiles,ASCIIcharactercodes:fromkeyboardinputbuffer,userinput:keyboardinputbuffer,keyboardinputbuffer:readingstringsfrom,strings:readingfromfiles,files:readingstringsfrom,searching:files,end-of-linemarkers,files:end-of-linemarker,end-of-linemarkers,openfiles,objects:redrawingincurrentviewport,viewports:redrawing:objects,viewports:redrawing:currentviewport,

Page 7: less than or equalAutoLISP Functions

applications:registering,registering:applications,applications:naming,extendeddata,namingapplications,objects:extendeddata,entities:extendeddata,applications:usingextendeddata,mathematicalfunctions:division,division,determiningremainders,remainders,indivision,expressions:evaluating:aspecifiednumberoftimes,expressions:re-evaluation,specified,evaluatingexpressions:repetitionspecified,lists:reversingelements,elements:reversinginlists,strings:converting:numbersto,numbers:convertingtostrings,converting:numberstostrings,realnumbers:convertingtostrings,integers:convertingtostrings,symbols:settingvaluestoexpressions,expressions:settingsymbolvaluesto,symbols:settingvaluestoexpressions,dialogboxes:tilevalues,setting,tiles:settingvalueindialogboxes,application-specificdata:writingtotheAppDatasectionofacad.cfg,acad.cfg,AppDatasection,files:acad.cfg,applications:AppDatasectionofacad.cfg,environmentvariables:settingvaluesfor,environmentvariables:spellingrequirementsfor,commands:registering,registering:commands,userinput:Helpfilecommands,Help:registeringuser-definedcommandswith,symbols:settingvaluestoexpressions,expressions:settingsymbolvaluesto,symbols:settingvaluestoexpressions,variables:settingvalues,systemvariables:settingvalues,ANGBASEsystemvariable,SNAPANGsystemvariable,views,establishing,viewports:specifyingviews,sineofangle,angles:sineof,tiles:displayingslidesin,slides,displayingindialogboxes,dialogboxes:displayingslidesin,images:displayingslides,symboltables:checkingnamesofvalidcharacters,symbols:namingwithvalidcharacters,naming:validcharactersforsymbols,symbols:invalidcharacters(table),squareroots,asrealnumbers,realnumbers:squareroots,selectionsets:addingnewobjects,selectionsets:creating,objects:addingtoselectionsets,entities:addingtoselectionsets,deleting:objects,entities:deleting:fromselectionsets,selectionsets:deletingobjectsfrom,objects:deletingfromselectionsets,selectionsets:objectselectionmethods(list),objects:creatingselectionsetsfrom,entities:creating:selectionsets,selectionsets:creating,grippedobjects,objects:selectedandgripped,selectionsets:selectedandgripped,entities:numberinselectionset,selectionsets:numberofobjectsin,objects:numberinselectionset,objects:testingforselectionsetmembership,selectionsets:testingformembershipof,selectionsets:members,determining,indexedelementsofselectionsets,selectionsets:indexedelementsof,elements:indexed,names:ofentitiesinselectionssets,selectionsets:returningentitynames,entities:inselectionsets,selectionsets:creationinformation,selectionsets:selectionmethodIDs(table),selectionsets:pointdescriptorIDs(table),grippedobjects,objects:selectedandgripped,selectionsets:selectedandgripped,entities:selectingforset,objects:gripping,entities:gripping,

Page 8: less than or equalAutoLISP Functions

objects:selectingforset,applications:startingWindowsapplications,Windowsapplications,starting,dialogboxes:displaying,dialogboxes:remainingactive,dialogboxes:starting,userinput:openingdialogboxes,images:creatingindialogboxes,tiles:creatingimagesindialogboxes,dialogboxes:imagecreation,lists:processing,dialogboxes:pop-uplists,dialogboxes:processinglists,pop-uplists,processingindialogboxes,characters:convertingcaseof,converting:caseofalphabeticcharacters,uppercasecharacters,converting,caseconversions,lowercasecharacters,converting,strings:concatenatingmultiplestrings,concatenating:multiplestrings,strings:numberofcharactersin,characters:quantityinstrings,integers:quantityofstringcharacters,substitutinglistitems,searching:lists:forolditems,lists:substitutingnewitems,lists:replacingolditems,substrings.Seestrings,strings:substrings,tablet(digitizer)calibrations,digitizers,settingcalibrations,calibrations,digitizercoordinates,symboltables:findingnextitem,entities:searchinginsymboltables,symboltables:searching:forobjectnames,objects:searchingsymboltablesfor,symbols:searchingfornamesinsymboltables,symboltables:searching:forsymbolnames,userinput:terminatingdialogboxes,dialogboxes:terminating,terminatingdialogboxes,newlines,printingtocommandline,commandline:printingnewlinesto,measuringtextobjects,textobjects,measuring,coordinates,intextboxes,textboxes,diagonalcoordinates,graphicsscreen:switchingtotextscreen,screens:switchinggraphicsscreentotextscreen,textscreen,switchingfromgraphicsscreen,graphicsscreen:displayedinAutoCAD,FlipScreenfunctionkey,screens:FlipScreenfunctionkey,tracefunction,debugging,debugging:tracefunction,displacements,translating,translatingpointsordisplacements,ObjectCoordinateSystem(OCS),coordinatesystems:translatingpoints,points:translatingbetweencoordinatesystems,datatypes(list),typefunction,datatypes(list),DCLfiles:unloading,dialogboxes:unloadingDCLfiles,unloading:DCLfiles,loading:Seealsounloading,unloading:Seealsoloading,untracefunction,debugging,debugging:untracefunction,traceflag,clearing,dialogboxes:drawingvectorsin,images:vectorsindialogboxes,vectors:indialogboximages,graphicsvectors:indialogboximages,strings:containingAutoLISPversionnumber,versionofcurrentAutoLISP,definingfunctionsymbolsasexternalsubroutines,symbols:functionsymbols:defining,functionsymbols:definingasexternalsubroutines,symbols:externalsubroutines,subroutines,external,externalsubroutines,definingsymbolsas,symbols:functionsymbols:undefining,functionsymbols:undefining,undefiningfunctionsymbols,ObjectARXapplications:undefiningsymbols,symbols:undefiningforObjectARX,VLXapplications:separate-namespace.Seeseparate-namespaceVLX,separate-

Page 9: less than or equalAutoLISP Functions

namespaceVLX:importingfunctionsto,functions:importing,applications:separate-namespaceVLX,importingfunctions:ADS-DEFUN,importingfunctions:fromObjectARX,namespaces:blackboardnamespacevariables,variables:inblackboardnamespace,blackboardnamespace:returningvariablevaluefrom,namespaces:blackboardnamespacevariables,variables:inblackboardnamespace,blackboardnamespace:settingvariables,trappingerrors,arguments,passingtofunctions,errorobjects:returnedfromvl-catch-all-apply,errortrapping,interceptingerrors,errormessages:inerrorobjects,errorobjects:viewingerrormessagesin,errorobjects:returnedfromvl-catch-all-apply,AutoCADcommands:executing,commands:executinginAutoCAD,variables:validlistdefinitions,lists:validlistdefinitions,files:listingindirectories,directories:listingallfiles,AutoCADdocuments,functionavailability,functions:availabilityinAutoCADdocuments,namespaces:importingfunctions,functions:importing:intoVLXnamespace,namespaces:variablevalues,variables:retrievingvaluesfromnamespace,namespaces:variablevalues,variables:settingvalues:innamespace,lists:testingelementsin,testfunctions,forlists,errorhandling:VLXapplications,VLXapplications:errorhandlers,VLXapplications:invokingfromanothernamespace,functions:invokingVLX,files:copying,files:appending,deleting:files,files:deleting,directories:usingpathnames,directories:filenamesreferringto,renaming:files,files:renaming,bytes,forfilesize,files:determiningsizeof,files:timeoflastmodification,files:naming:withoutdirectoryorextension,files:naming:withextensiononly,naming:files:temporaryfiles,files:naming:temporaryfiles,temporaryfiles,naming,.txtfiles,inVLX,VLXapplications:.txtresourcefilesin,atoms:anddottedlists,lists:constructing,dottedlists:andatoms,charactercodes:list,integers:listscombiningcharacters,VLXapplications:exportingfunctions,functions:exportedbyVLX,lists:length,determining,VLXapplications:andcurrentdocument,loadingfiles:intoAutoCAD,files:loading:inAutoCADdocuments,loading:extendedVisualLISPfunctions,VisualLISP:loadingextensionstoAutoLISP,functions:loadingVisualLISPextensionstoAutoLISP,lists:testingelementsin,testfunctions,forlists,nil:testinglistelementsfor,lists:testingelementsin,testfunctions,forlists,xdata.Seeextendeddata,indexoflistelement,determining,lists:determiningindexofitem,lists:itempositionin,AutoLISPdata,displayingasoutputfromprin1/princ,namespaces:variablesinopendocuments,variables:copyingvaluesintodocumentnamespaces,Windowsregistry:deletingkeysorvaluesfrom,subkeys,inWindowsregistry,Windowsregistry:subkeys,Windowsregistry:storeddataforkeys,registrykeys,creatinginWindows,Windowsregistry:creatingkeysin,elements:removingfromlists,lists:removingelements

Page 10: less than or equalAutoLISP Functions

from,lists:testingelementsin,testfunctions,forlists,testfunctions,forlists,lists:testingelementsin,nil:testingpredicatefor,comparisonfunction:inlists,lists:comparisonfunction,lists:eliminatingduplicateelements,sorting:lists,lists:comparisonfunction,lists:eliminatingduplicateelements,comparisonfunction:inlists,lists:elementindexvalues,charactercodes:convertingfromstrings,ASCIIcharactercodes:representingcharacters,lists:deletingleadingcharacters,strings:longestcommonprefix,strings:searching:forASCIIcode,lists:deletingendcharacters,strings:searching:forpatterns,patterns:searchinginstrings,strings:replacingpatterns,patterns:replacinginstrings,strings:substitutingcharacters,lists:deletingendcharacters,lists:deletingbeginningcharacters,symbols:nameinuppercase,symbols:valueboundto,entities:identifyingsymbols,symbols:identifyingforobjects,objects:identifyingsymbols,unloading:VLXapplications,VLXapplications:unloading,loading:VisualBasicprojects,VisualBasicprojects:loading,VisualBasicprojects:runningmacros,macros,VisualBasic,separate-namespaceVLX:determiningifloaded,VLXapplications:determiningifloaded,points:3D,3Dpoints:ActiveX-compatible,ActiveX:creating3Dpointscompatiblewith,commands:addingtoAutoCAD,AutoCADcommands:addingtobuilt-incommandset,applications:connectingwithActiveX,applicationobjects:creatingnewinstancesof,curves:creatinginsideareaof,curves:findingnearestpointof,planes:nearestpointonprojectedcurve,curves:projectingontoplanes,curves:definingparametersof,curves:segmentlength:toparameter,curves:segmentlength:toselectedpoint,endpoints:ofcurves,curves:parameters:ofendpoints,WorldCoordinateSystem:endpointsincurves,curves:WCSendpoints,curves:firstderivativeof,curves:parameters:atspecifieddistance,curves:parameters:inWCS,curves:points:atspecifieddistance,curves:points:atspecifiedparameter,curves:secondderivative,curves:startparameter,WorldCoordinateSystem:startpointincurves,curves:WCSstartpoint,endpoints:equaltostartpointincurves,curves:closed,curves:periodic,curves:infiniterangesof,infiniteranges,incurves,periodiccurves,curves:inplanes,planes:containingcurves,objects:methodsapplicableto,listing,objects:propertiesof:listing,converting:enametoVLA-object,objects:transformingenametoVLA-object,entities:transformingtoVLA-object,entities:erasing,objects:determiningiferased,collections:evaluating,entities:toplevelinAutoCAD,objects:toplevelinAutoCAD,applications:connectingwithActiveX,applicationobjects:returningrunninginstancesof,entities:creating:newinstanceof,objects:creatingnewinstanceof,ActiveX:gettingobjectproperties,objects:propertiesof,VLA-objects,gettingproperties,importingdata,fromtypelibraries,typelibraries,importingdata

Page 11: less than or equalAutoLISP Functions

from,methods:callingActiveX,dictionaries:erasingLISPdata,entities:retrievingLISPdata,dictionaries:retrievingLISPdata,objects:retrievingLISPdata,dictionaries:listingLISPdata,entities:storingLISPdata,dictionaries:storingLISPdata,objects:storingLISPdata,savingdata,insessionboundaries,sessionboundaries,savingdata,safearrays:creating,variants:creating,functions:applyingtoobjects,collections:applyingfunctionsto,methods:determiningobjectsupportfor,objects:methodssupportedby,objects:releasing,registrypath,inAutoCAD,entities:specifyingproperties,objects:specifyingproperties,properties:specifyinginobjects,properties:settinginActiveX,objects:settingpropertiesinActiveX,entities:determiningifreadable,objects:determiningifreadable,entities:releasingindrawings,objects:releasingindrawings,commands:removing,safearrays:storingdatainelementsof,safearrays:numberofdimensions,dimensions:ofsafearrays,arrays:Seealsosafearrays,safearrays:specifyingindexesofelements,safearrays:dimensionboundariesof,boundaries,insafearrays,safearrays:lowerboundaries,dimensions:ofarrays,safearrays:returningstartindexof,safearrays:upperboundaries,safearrays:dimensionboundariesof,dimensions:ofarrays,arrays:returningendindexof,arrays:dimensionboundariesof,safearrays:addingelements,safearrays:datatypesof,safearrays:displayingaslists,ActiveX:creatingtransformationmatrices,transformationmatrix:VLAmethods,methods:convertingtransformationmatrixfor,TypeLibinformation,objects:TypeLibinformation,entities:TypeLibinformation,variants:changingdatatypeof,variants:determiningdatatypeof,variants:returningvaluesof,converting:VLA-objecttoename,objects:transformingVLA-objecttoename,entities:transformingVLA-objectto,objects:modifyinginAutoCADdrawings,FASfiles,compilingsourcecodeinto,sourcecode,compilingintoFASfiles,reactorobjects.Seereactors,reactors:constructing,objects:changingindrawingdatabase,databasereactors,creating,reactorevents(table),reactors:enabling,reactors:enabled,determining,beepsounds,commandevents,andeditorreactors,editorreactors:commandeventnotification,commandreactorevents(table),events,currentwithinreactor'scallback,application-specificdata:inreactorobjects,reactors:application-specificdata,reactors:dataassociatedwith,reactors:overwritingapplication-specificdata,deepclonereactors,creating,reactors:deepcloningnotification,deepcloning,reactornotification,DeepClonereactorevents,(table),documentreactors,creating,reactors:fordrawingdocumentevents,DocManagerreactorevents(table),DWGreactors,creating,reactors:drawingeventnotification,DWGreactorevents(table),DXFreactors,creating,reactors:DXFfileeventnotification,DXFreactorevents(table),editorreactors:constructing,editorreactorevents(table),blocks:insertingineditor

Page 12: less than or equalAutoLISP Functions

reactors,insertreactorevents(table),ObjectARXapplications:reactornotificationand,reactors:ofObjectARXapplicationnotification,linkerreactors,creating,linkerreactorevents(table),LISPreactors,creating,reactors:LISPeventnotification,LISPreactorevents(table),editorreactors:creating,reactors:miscellaneouseditortypes,miscellaneousreactorevents(table),mousereactors,creating,reactors:mouseeventnotification,mousereactorevents(table),reactors:inactivenamespaceand,objectreactors:constructing,reactors:objectreactors,constructing,objectreactors:Seealsoreactors,objectevents(table),objectreactors:addingtolistofowners,objectreactors:removingfromlistofowners,objectreactors:ownersof,persistentreactors,declaring,reactors:persistent:making,reactors:persistent:incurrentdrawing,reactors:persistent:determining,reactors:transient,making,reactors:callbackconditions,reactors:replacingcallbackfunctions,callbackfunctions:replacing,reactors:pairs,listof,reactors:Seealsoeditorreactors;objectreactors,reactors:existing,listof,reactors:disablingonereactor,reactors:disablingallforaspecifiedtype,callbackfunctions:andinactivenamespaces,editorreactors:systemvariablechangenotification,editorreactors:toolbarbitmapchangenotification,callbackfunctions:printingargumentsinTracewindow,Tracewindow,callbackarguments,reactortypes:identifying,reactors:identifyingtypeof,reactortypes:listing,editorreactors:undoeventnotification,blocks:writingtoreactorevents,editorreactors:writingtoblocknotification,editorreactors:modifyingAutoCADwindownotification,editorreactors:modifyingxrefs,viewports:currentconfigurations,viewports:listingdescriptors,wild-cardpatternmatch,patterns:matchingwithwildcards,expressions:evaluating:repetitively,evaluatingexpressions:repetitively,files:writingcharactersto,screens:writingcharactersto,writing:characters,output.Seewriting,files:writingstringsto,writing:strings,screens:writingstringsto,objects:extendedobjectdata,functions,functions:extendeddata-handling,entities:linkingasextendeddata,lists:linkedtoobjectsasextendeddata,objects:linkedasextendeddata,zero,testingnumberfor,numbers:evaluatingtozero,">

AutoLISPReferenceGuide>

AutoLISPFunctions

Page 13: less than or equalAutoLISP Functions

ThefollowingisacatalogoftheAutoLISP®functionsavailableinAutoCAD®.Thefunctionsarelistedalphabetically.

Inthischapter,eachlistingcontainsabriefdescriptionofthefunction'suseandafunctionsyntaxstatementshowingtheorderandthetypeofargumentsrequiredbythefunction.

Notethatanyfunctions,variables,orfeaturesnotdescribedhereorinotherpartsofthedocumentationarenotofficiallysupportedandaresubjecttochangeinfuturereleases.

Forinformationonsyntax,seeAutoLISPFunctionSyntaxintheAutoLISPDeveloper'sGuide.

Notethatthevaluereturnedbysomefunctionsiscategorizedasunspecified.Thisindicatesyoucannotrelyonusingthevaluereturnedfromthisfunction.

OperatorsAFunctionsBFunctionsCFunctionsDFunctionsEFunctionsFFunctionsGFunctionsHFunctionsIFunctionsLFunctionsMFunctionsNFunctionsOFunctionsPFunctionsQFunctionsRFunctionsSFunctions

Page 14: less than or equalAutoLISP Functions

TFunctionsUFunctionsVFunctionsWFunctionsXFunctionsZFunctions

Pleasesendusyourcommentaboutthispage

Page 15: less than or equalAutoLISP Functions

<(lessthan),<(lessthan),lessthanoperator,operators:\<=(lessthanorequalto),<=(lessthanorequalto),lessthanorequaltooperator,mathematicalfunctions:lessthanorequalto,operators:>(greaterthan),>(greaterthan),greaterthanoperator,mathematicalfunctions:greaterthan,operators:>=(greaterthanorequalto),>=(greaterthanorequalto),greaterthanorequaltooperator,operators:~(bitwiseNOT),bitwiseNOToperator,~(bitwiseNOT),mathematicalfunctions:bitwiseNOT,operators:1+(increment),1+(increment),incrementoperator,incrementingnumbers,numbers:incrementing,operators:1-(decrement),decrementoperator,1-(decrement),decrementingnumbers,numbers:decrementing,">

AutoLISPReferenceGuide>AutoLISPFunctions>

Operators

+(add)Returnsthesumofallnumbers.-(subtract)Subtractsthesecondandfollowingnumbersfromthefirstandreturnsthedifference*(multiply)Returnstheproductofallnumbers/(divide)Dividesthefirstnumberbytheproductoftheremainingnumbersandreturnsthequotient=(equalto)Comparesargumentsfornumericalequality/=(notequalto)Comparesargumentsfornumericalinequality<(lessthan)ReturnsTifeachargumentisnumericallylessthantheargumenttoits

Page 16: less than or equalAutoLISP Functions

right;otherwisenil<=(lessthanorequalto)ReturnsTifeachargumentisnumericallylessthanorequaltotheargumenttoitsright;otherwisereturnsnil>(greaterthan)ReturnsTifeachargumentisnumericallygreaterthantheargumenttoitsright;otherwisereturnsnil>=(greaterthanorequalto)ReturnsTifeachargumentisnumericallygreaterthanorequaltotheargumenttoitsright;otherwisereturnsnil~(bitwiseNOT)ReturnsthebitwiseNOT(1'scomplement)oftheargument1+(increment)Incrementsanumberby11-(decrement)Decrementsanumberby1

Pleasesendusyourcommentaboutthispage

Page 17: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

+(add)

Returnsthesumofallnumbers.

(+[numbernumber]...)

Arguments

number

Anumber.

ReturnValues

Theresultoftheaddition.Ifyousupplyonlyonenumberargument,thisfunctionreturnstheresultofaddingittozero.Ifyousupplynoarguments,thefunctionreturns0.

Examples

(+12)returns3

(+1234.5)returns10.5

(+1234.0)returns10.0

Pleasesendusyourcommentaboutthispage

Page 18: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

-(subtract)

Subtractsthesecondandfollowingnumbersfromthefirstandreturnsthedifference

(-[numbernumber]...)

Arguments

number

Anumber.

ReturnValues

Theresultofthesubtraction.Ifyousupplymorethantwonumberarguments,thisfunctionreturnstheresultofsubtractingthesumofthesecondthroughthelastnumbersfromthefirstnumber.Ifyousupplyonlyonenumberargument,thisfunctionsubtractsthenumberfromzero,andreturnsanegativenumber.Supplyingnoargumentsreturns0.

Examples

(-5040)returns10

(-5040.0)returns10.0

(-5040.02.5)returns7.5

(-8)returns-8

Pleasesendusyourcommentaboutthispage

Page 19: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

*(multiply)

Returnstheproductofallnumbers

(*[numbernumber]...)

Arguments

number

Anumber.

ReturnValues

Theresultofthemultiplication.Ifyousupplyonlyonenumberargument,thisfunctionreturnstheresultofmultiplyingitbyone;itreturnsthenumber.Supplyingnoargumentsreturns0.

Examples

(*23)returns 6(*23.0)returns 6.0(*234.0)returns24.0

(*3-4.5)returns-13.5

(*3)returns3

Pleasesendusyourcommentaboutthispage

Page 20: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

/(divide)

Dividesthefirstnumberbytheproductoftheremainingnumbersandreturnsthequotient

(/[numbernumber]...)

Arguments

number

Anumber.

ReturnValues

Theresultofthedivision.Ifyousupplymorethantwonumberarguments,thisfunctiondividesthefirstnumberbytheproductofthesecondthroughthelastnumbers,andreturnsthefinalquotient.Ifyousupplyonenumberargument,thisfunctionreturnstheresultofdividingitbyone;itreturnsthenumber.Supplyingnoargumentsreturns0.

Examples

(/1002)returns50

(/1002.0)returns50.0

(/10020.02)returns2.5

(/100202)returns2

(/4)returns4

Pleasesendusyourcommentaboutthispage

Page 21: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

=(equalto)

Comparesargumentsfornumericalequality

(=numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifallargumentsarenumericallyequal;otherwisenil.Ifonlyoneargumentissupplied,=returnsT.

Examples

(=44.0)returnsT

(=20388)returnsnil

(=2.42.42.4)returnsT

(=499499500)returnsnil

(="me""me")returnsT

(="me""you")returnsnil

SeeAlsoTheeqandequalfunctions.

Pleasesendusyourcommentaboutthispage

Page 22: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

/=(notequalto)

Comparesargumentsfornumericalinequality

(/=numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifnotwosuccessiveargumentsarethesameinvalue;otherwisenil.Ifonlyoneargumentissupplied,/=returnsT.

Notethatthebehaviorof/=doesnotquiteconformtootherLISPdialects.ThestandardbehavioristoreturnTifnotwoargumentsinthelisthavethesamevalue.InAutoLISP,/=returnsTifnosuccessiveargumentshavethesamevalue;seetheexamplesthatfollow.

Examples

(/=1020)returnsT

(/="you""you")returnsnil

(/=5.435.44)returnsT

(/=1020102020)returnsnil

(/=10201020)returnsT

Note Inthelastexample,althoughtherearetwoargumentsinthelistwiththesamevalue,theydonotfollowoneanother;thus/=evaluatestoT.

Pleasesendusyourcommentaboutthispage

Page 23: less than or equalAutoLISP Functions

<(lessthan)"><(lessthan),<(lessthan),lessthanoperator,">

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

<(lessthan)

ReturnsTifeachargumentisnumericallylessthantheargumenttoitsright;otherwisenil

(<numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifeachargumentisnumericallylessthantheargumenttoitsright;otherwisereturnsnil.Ifonlyoneargumentissupplied,<returnsT.

Examples

(<1020)returnsT

(<"b""c")returnsT

(<35733.2)returnsnil

(<2388)returnsT

(<2344)returnsnil

Pleasesendusyourcommentaboutthispage

Page 24: less than or equalAutoLISP Functions

<=(lessthanorequalto)"><=(lessthanorequalto),<=(lessthanorequalto),lessthanorequaltooperator,mathematicalfunctions:lessthanorequalto,">

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

<=(lessthanorequalto)

ReturnsTifeachargumentisnumericallylessthanorequaltotheargumenttoitsright;otherwisereturnsnil

(<=numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifeachargumentisnumericallylessthanorequaltotheargumenttoitsright;otherwisereturnsnil.Ifonlyoneargumentissupplied,<=returnsT.

Examples

(<=1020)returnsT

(<="b""b")returnsT

(<=35733.2)returnsnil

(<=299)returnsT

(<=2945)returnsnil

Pleasesendusyourcommentaboutthispage

Page 25: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

>(greaterthan)

ReturnsTifeachargumentisnumericallygreaterthantheargumenttoitsright;otherwisereturnsnil

(>numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifeachargumentisnumericallygreaterthantheargumenttoitsright;otherwisenil.Ifonlyoneargumentissupplied,>returnsT.

Examples

(>12017)returnsT

(>"c""b")returnsT

(>3.51792)returnsnil

(>7742)returnsT

(>7744)returnsnil

Pleasesendusyourcommentaboutthispage

Page 26: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

>=(greaterthanorequalto)

ReturnsTifeachargumentisnumericallygreaterthanorequaltotheargumenttoitsright;otherwisereturnsnil

(>=numstr[numstr]...)

Arguments

numstr

Anumberorastring.

ReturnValues

T,ifeachargumentisnumericallygreaterthanorequaltotheargumenttoitsright;otherwisenil.Ifonlyoneargumentissupplied,>=returnsT.

Examples

(>=12017)returnsT

(>="c""c")returnsT

(>=3.51792)returnsnil

(>=7744)returnsT

(>=7749)returnsnil

Pleasesendusyourcommentaboutthispage

Page 27: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

~(bitwiseNOT)

ReturnsthebitwiseNOT(1'scomplement)oftheargument

(~int)

Arguments

int

Aninteger.

ReturnValues

ThebitwiseNOT(1'scomplement)oftheargument.

Examples

(~3)returns-4

(~100)returns-101

(~-4)returns 3

Pleasesendusyourcommentaboutthispage

Page 28: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

1+(increment)

Incrementsanumberby1

(1+number)

Arguments

number

Anynumber.

ReturnValues

Theargument,increasedby1.

Examples

(1+5)returns 6(1+-17.5)returns-16.5

Pleasesendusyourcommentaboutthispage

Page 29: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>Operators>

1-(decrement)

Decrementsanumberby1

(1-number)

Arguments

number

Anynumber.

ReturnValues

Theargument,reducedby1.

Examples

(1-5)returns 4(1--17.5)returns-18.5

Pleasesendusyourcommentaboutthispage

Page 30: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

AFunctions

absReturnstheabsolutevalueofanumberacad_colordlgDisplaysthestandardAutoCADcolorselectiondialogboxacad_helpdlgInvokesthehelpfacility(obsolete)acad-pop-dbmodRestoresthevalueoftheDBMODsystemvariabletothevaluethatwasmostrecentlystoredwithacad-push-dbmodacad-push-dbmodStoresthecurrentvalueoftheDBMODsystemvariableacad_strlsortSortsalistofstringsinalphabeticalorderacad_truecolorcliPromptsforcolorsatthecommandlineacad_truecolordlgDisplaystheAutoCADcolorselectiondialogboxwithtabsforindexcolor,truecolor,andcolorbooksacdimenableupdateControlstheautomaticupdatingofassociativedimensionsacet-layerp-modeQueriesandsetstheLAYERPMODEsettingacet-layerp-mark

Page 31: less than or equalAutoLISP Functions

PlacesbeginningandendingmarksforLayerPreviousrecordingacet-laytransTranslatesdrawinglayerstostandardsdefinedinanotherdrawingorstandardsfileacet-ms-to-psConvertsarealvaluefrommodelspaceunitstopaperspaceunitsacet-ps-to-msConvertsarealvaluefrompaperspaceunitstomodelspaceunitsaction_tileAssignsanactiontoevaluatewhentheuserselectsthespecifiedtileinadialogboxadd_listAddsormodifiesastringinthecurrentlyactivedialogboxlistalertDisplaysadialogboxcontaininganerrororwarningmessageallocSetsthesizeofthesegmenttobeusedbytheexpandfunctionandReturnsthelogicalANDofthesuppliedargumentsangleReturnsanangleinradiansofalinedefinedbytwoendpointsangtofConvertsastringrepresentinganangleintoareal(floating-point)valueinradiansangtosConvertsanangularvalueinradiansintoastringappendTakesanynumberoflistsandappendsthemtogetherasonelistapplyPassesalistofargumentsto,andexecutes,aspecifiedfunction

Page 32: less than or equalAutoLISP Functions

arxReturnsalistofthecurrentlyloadedObjectARXapplicationsarxloadLoadsanObjectARXapplicationarxunloadUnloadsanObjectARXapplicationasciiReturnstheconversionofthefirstcharacterofastringintoitsASCIIcharactercode(aninteger)assocSearchesanassociationlistforanelementandreturnsthatassociationlistentryatanReturnsthearctangentofanumberinradiansatofConvertsastringintoarealnumberatoiConvertsastringintoanintegeratomVerifiesthatanitemisanatomatoms-familyReturnsalistofthecurrentlydefinedsymbolsautoarxloadPredefinescommandnamestoloadanassociatedObjectARXfileautoloadPredefinescommandnamestoloadanassociatedAutoLISPfile

Pleasesendusyourcommentaboutthispage

Page 33: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

abs

Returnstheabsolutevalueofanumber

(absnumber)

Arguments

number

Anynumber.

ReturnValues

Theabsolutevalueoftheargument.

Examples

(abs100)returns100

(abs-100)returns100

(abs-99.25)returns99.25

Pleasesendusyourcommentaboutthispage

Page 34: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad_colordlg

DisplaysthestandardAutoCADcolorselectiondialogbox

(acad_colordlgcolornum[flag])

Arguments

colornum

Anintegerintherange0-256(inclusive),specifyingtheAutoCADcolornumbertodisplayastheinitialdefault.

flag

Ifsettonil,disablestheByLayerandByBlockbuttons.Omittingtheflagargumentorsettingittoanon-nilvalueenablestheByLayerandByBlockbuttons.

Acolornumvalueof0defaultstoByBlock,andavalueof256defaultstoByLayer.

ReturnValues

Theuser-selectedcolornumber;otherwisenil,iftheusercancelsthedialogbox.

Examples

Prompttheusertoselectacolor,anddefaulttogreenifnoneisselected:

(acad_colordlg3)

Pleasesendusyourcommentaboutthispage

Page 35: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad_helpdlg

Invokesthehelpfacility(obsolete)

(acad_helpdlghelpfiletopic)

Thisexternallydefinedfunctionhasbeenreplacedbythebuilt-infunctionhelp.ItisprovidedforcompatibilitywithpreviousreleasesofAutoCAD.

SeeAlsoThehelpfunctionforacompletedescriptionofthisfunction.

Pleasesendusyourcommentaboutthispage

Page 36: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad-pop-dbmod

RestoresthevalueoftheDBMODsystemvariabletothevaluethatwasmostrecentlystoredwithacad-push-dbmod

(acad-pop-dbmod)

Thisfunctionisusedwithacad-push-dbmodtocontroltheDBMODsystemvariable.TheDBMODsystemvariabletrackschangestoadrawingandtriggerssave-drawingqueries.

Thisfunctionisimplementedinacapp.arx,whichisloadedbydefault.ThisfunctionpopsthecurrentvalueoftheDBMODsystemvariableoffaninternalstack.

ReturnValues

ReturnsTifsuccessful;otherwise,ifthestackisempty,returnsnil.

Pleasesendusyourcommentaboutthispage

Page 37: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad-push-dbmod

StoresthecurrentvalueoftheDBMODsystemvariable

(acad-push-dbmod)

Thisfunctionisusedwithacad-pop-dbmodtocontroltheDBMODsystemvariable.YoucanusethisfunctiontochangeadrawingwithoutchangingtheDBMODsystemvariable.TheDBMODsystemvariabletrackschangestoadrawingandtriggerssave-drawingqueries.

Thisfunctionisimplementedinacapp.arx,whichisloadedbydefault.ThisfunctionpushesthecurrentvalueoftheDBMODsystemvariableontoaninternalstack.Touseacad-push-dbmodandacad-pop-dbmod,precedeoperationswithacad-push-dbmodandthenuseacad-pop-dbmodtorestoretheoriginalvalueoftheDBMODsystemvariable.

ReturnValues

AlwaysreturnsT.

Examples

Thefollowingexampleshowshowtostorethemodificationstatusofadrawing,changethestatus,andthenrestoretheoriginalstatus.

(acad-push-dbmod)

(setqnew_line'((0."LINE")(100."AcDbEntity")(8."0")

(100."AcDbLine")(101.02.00.0)(112.01.00.0)

(2100.00.01.0)))

(entmakenew_line);SetDBMODtoflag1

(command"_color""2");SetDBMODtoflag4

(command"_-vports""_SI");SetDBMODtoflag8

(command"_vpoint""0,0,1");SetDBMODtoflag16

(acad-pop-dbmod);SetDBMODtooriginalvalue

Page 38: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 39: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad_strlsort

Sortsalistofstringsinalphabeticalorder

(acad_strlsortlist)

Arguments

list

Thelistofstringstobesorted.

ReturnValues

Thelistinalphabeticalorder.Ifthelistisinvalidorifthereisnotenoughmemorytodothesort,acad_strlsortreturnsnil.

Examples

Sortalistofabbreviatedmonthnames:Command:(setqmos'("Jan""Feb""Mar""Apr""May""Jun""Jul""Aug"

"Sep""Oct""Nov""Dec"))

("Jan""Feb""Mar""Apr""May""Jun""Jul""Aug""Sep""Oct""Nov""Dec")

Command:(acad_strlsortmos)

("Apr""Aug""Dec""Feb""Jan""Jul""Jun""Mar""May""Nov""Oct""Sep")

Pleasesendusyourcommentaboutthispage

Page 40: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad_truecolorcli

Promptsforcolorsatthecommandline

(acad_truecolorclicolor[allowbylayer][alternatePrompt])

Arguments

color

Adottedpairthatdescribesthedefaultcolor.Thefirstelementofthedottedpairmustbeoneofthecolor-relatedDXFgroupcodes(62,420,or430);forexample,(62.ColorIndex),(420.TrueColor),or(430."colorbook$colorname").

allowbylayer

Omittingtheallowbylayerargumentorsettingittoanon-nilvalueenablesenteringbylayerorbyblocktosetthecolor.Ifsettonil,anerrorresultsifbylayerorbyblockisentered.

alternateprompt

Anoptionalpromptstring.Ifthisstringisomitted,thedefaultvalueis“Newcolor”.

ReturnValues

Whentheoperationissuccessful,thefunctionreturnsalistofoneormoredottedpairs(dependingonthetabonwhichthecolorisselected)describingthecolorselected.Thelastdottedpairinthelistindicatesthecolorselected.Thefunctionreturnsniliftheusercancelsthedialogbox.

Colorbookcolor

Ifthelastiteminthereturnedlistisa430pair,thenthespecifiedcolororiginatesfromacolorbook.Thisreturnedlistwillalsocontaina420pair

Page 41: less than or equalAutoLISP Functions

thatdescribesthecorrespondingtruecoloranda62pairthatdescribestheclosestmatchingcolorindexvalue.

Truecolor

Ifthereturnedlistcontainsa420pairasthelastitem,thenatruecolorwasspecified(as“Red,Green,Blue”).Thelistwillalsocontaina62pairthatindicatestheclosestmatchingcolorindex.No430pairwillbepresent.

Colorindex

Ifthelastiteminthelistisa62pair,thenacolorindexwaschosen.Nootherdottedpairswillbepresentinthereturnedlist.

Examples

Promptforacolorselectionatthecommandlinewithapurplecolorindexdefaultselectionandalternativetextforthecommandprompt:

Command:(acad_truecolorcli'(62.215)1"Pickacolor")

NewColor[Truecolor/COlorbook]<215>:

((62.215))

Promptforacolorselectionatthecommandlinewithayellowcolorindexdefaultselection,thensetthecolorbylayer:

Command:(acad_truecolorcli'(62.2))

NewColor[Truecolor/COlorbook]<2(yellow)>:bylayer

((62.256))

Pleasesendusyourcommentaboutthispage

Page 42: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acad_truecolordlg

DisplaystheAutoCADcolorselectiondialogboxwithtabsforindexcolor,truecolor,andcolorbooks

(acad_truecolordlgcolor[allowbylayer][currentlayercolor])

Arguments

color

Adottedpairthatdescribesthedefaultcolor.Thefirstelementofthedottedpairmustbeoneofthecolor-relatedDXFgroupcodes(62,420,or430);forexample,(62.ColorIndex),(420.TrueColor),or(430."colorbook$colorname").

allowbylayer

Ifsettonil,disablestheByLayerandByBlockbuttons.Omittingtheallowbylayerargumentorsettingittoanon-nilvalueenablestheByLayerandByBlockbuttons.

currentlayercolor

Optionaldottedpairinthesameformascolorthatsetsthevalueofthebylayer/byblockcolorinthedialog.

ReturnValues

Whentheoperationissuccessful,thefunctionreturnsalistofoneormoredottedpairs(dependingonthetabonwhichthecolorisselected)describingthecolorselected.Thelastdottedpairinthelistindicatesthecolorselected.Thefunctionreturnsniliftheusercancelsthedialogbox.

Colorbookcolor

Ifthelastiteminthereturnedlistisa430pair,thenthespecifiedcolor

Page 43: less than or equalAutoLISP Functions

originatesfromacolorbook.Thisreturnedlistwillalsocontaina420pairthatdescribesthecorrespondingtruecoloranda62pairthatdescribestheclosestmatchingcolorindexvalue.

Truecolor

Ifthereturnedlistcontainsa420pairasthelastitem,thenatruecolorwasspecified(as“Red,Green,Blue”).Thelistwillalsocontaina62pairthatindicatestheclosestmatchingcolorindex.No430pairwillbepresent.

Colorindex

Ifthelastiteminthelistisa62pair,thenacolorindexwaschosen.Nootherdottedpairswillbepresentinthereturnedlist.

Examples

OpenthecolorselectiondialogtotheColorIndextabandacceptthepurpledefaultselection:

Command:(acad_truecolordlg'(62.215))

((62.215))

OpenthecolorselectiondialogtotheTrueColortabwithagreendefaultselectionandwiththeByLayerandByBlockbuttonsdisabled:

Command:(acad_truecolordlg'(420.2686760)nil)

((62.80)(420.2686760))

OpenthecolorselectiondialogtotheColorBookstabandacceptthemustarddefaultselection:

Command:(acad_truecolordlg'(430."RALCLASSIC$RAL1003"))

((62.40)(420.16235019)(430."RALCLASSIC$RAL1003"))

Pleasesendusyourcommentaboutthispage

Page 44: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acdimenableupdate

Controlstheautomaticupdatingofassociativedimensions

(acdimenableupdatenil|T)

Theacdimenableupdatefunctionisintendedfordeveloperswhoareeditinggeometryanddon'twantthedimensiontobeupdateduntilaftertheeditsarecomplete.

Arguments

nil

Associativedimensionswillnotupdate(evenifthegeometryismodified)untiltheDIMREGENcommandisentered.

T

Enableautomaticupdatingofassociativedimensionswhenthegeometryismodified.

ReturnValues

nil

Examples

Disabletheautomaticupdateofassociativedimensionsinthedrawing:Command:(acdimenableupdatenil)

Enabletheautomaticupdateofassociativedimensionsinthedrawing:Command:(acdimenableupdateT)

Pleasesendusyourcommentaboutthispage

Page 45: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acet-layerp-mode

QueriesandsetstheLAYERPMODEsetting

(acet-layerp-mode[status])

Arguments

status

SpecifyingTturnsLAYERPMODEon,enablinglayer-changetracking.NilturnsLAYERPMODEoff.Ifthisargumentisnotpresent,acet-layerp-modereturnsthecurrentstatusofLAYERPMODE.

ReturnValues

TifcurrentstatusofLAYERPMODEison;nilifLAYERPMODEisoff.

Examples

CheckthecurrentstatusofLAYERPMODE:Command:(acet-layerp-mode)

T

TurnLAYERPMODEoff:Command:(acet-layerp-modenil)

nil

CheckthecurrentstatusofLAYERPMODE:Command:(acet-layerp-mode)

nil

SeeAlso

Page 46: less than or equalAutoLISP Functions

TheLAYERPandLAYERPMODEcommandsintheCommandReference.

Pleasesendusyourcommentaboutthispage

Page 47: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acet-layerp-mark

PlacesbeginningandendingmarksforLayerPreviousrecording

(acet-layerp-mark[status])

Theacet-layerp-markfunctionallowsyoutogroupmultiplelayercommandsintoasingletransactionsothattheycanbeundonebyissuingLAYERPasingletime.LAYERPMODEmustbeoninordertosetmarks.

Arguments

status

SpecifyingTsetsabeginmark.Specifyingnilsetsanendmark,clearingthebeginmark.Ifstatusisomitted,acet-layerp-markreturnsthecurrentmarkstatusforlayersettings.

ReturnValues

Tifabeginmarkisineffect;otherwisenil.

Examples

Thefollowingcodechangeslayer0toblue,andthenmakesseveraladditionallayerchangesbetweenasetofbeginandendmarks.IfyouissueLAYERPafterrunningthiscode,layer0revertstoblue.

(defunTestLayerP()

;;TurnLAYERPMODEon,ifitisn'talready

(if(not(acet-layerp-mode))

(acet-layerp-modeT)

)

;;Setlayer0tothecolorblue

(command"_.layer""_color""blue""0""")

;;Setabeginmark

Page 48: less than or equalAutoLISP Functions

(acet-layerp-markT)

;;Issueaseriesoflayercommands,andthensetanendmark

(command"_.layer""_color""green""0""")

(command"_.layer""_thaw""*""")

(command"_.layer""_unlock""*""")

(command"_.layer""_ltype""hidden""0""")

(command"_.layer""_color""red""0""")

;;Setanendmark

(acet-layerp-marknil)

)

SeeAlsoTheLAYERPcommandintheCommandReference.

Pleasesendusyourcommentaboutthispage

Page 49: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acet-laytrans

Translatesdrawinglayerstostandardsdefinedinanotherdrawingorstandardsfile

(acet-laytrans“filename”[settings])

Arguments

filename

Astringspecifyingafilecontaininglayermappingstobeusedfortranslation.

settings

Abit-codedintegerspecifyingLayerTranslatorprocessingoptions.Thebitscanbeaddedtogetherinanycombinationtoformavaluebetween0and15.Ifthesettingsargumentisomitted,avalueof15(alloptionsselected)isassumed.Thebitvaluesareasfollows:0 Nooptions1 ForceentitycolortoBYLAYER2 ForceentitylinetypetoBYLAYER4 Translateobjectsinblocks8 Writetransactionlog

ReturnValues

Tiftranslationissuccessful;otherwisenil.

Examples

ThefollowingcommandtranslatesthecurrentdrawingusinglayermappingssavedinLayMap.dwg.Notransactionlogwillbeproduced,butallotherprocessingoptionswillbeineffect.

Page 50: less than or equalAutoLISP Functions

Command:(acet-laytrans"c:/mydocuments/caddrawings/LayMap.dwg"7)

T

SeeAlsoTheLAYTRANScommandintheCommandReference.

Pleasesendusyourcommentaboutthispage

Page 51: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acet-ms-to-ps

Convertsarealvaluefrommodelspaceunitstopaperspaceunits

(acet-ms-to-ps[value][viewport])

Ifboththevalueandviewportargumentsarespecified,thevalueisconvertedtopaperspaceunitsusingthespecifiedviewport.Nouserinputisrequired.

Ifonlythevalueargumentisspecified,thecurrentviewportisassumedandnouserinputisrequired.However,ifthecurrentspaceismodelspace,thereisnocurrentviewportandthefunctionwillfail(returningnil).Ifpaperspaceisthecurrentspace,thefunctionwilleitherpromptforaviewportifmorethanoneviewportexistsinthecurrentpaperspacelayout,orusethesingleexistingviewport.

Ifnoargumentsarespecified,thefunctionpromptsforavalueandconvertsitifpossible.

Arguments

value

Arealvaluetobeconverted.

viewport

Aviewportentityname(ads_name).

ReturnValues

Theconvertedrealvalueonsuccess;nilonfailure.

Pleasesendusyourcommentaboutthispage

Page 52: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

acet-ps-to-ms

Convertsarealvaluefrompaperspaceunitstomodelspaceunits

(acet-ps-to-ms[value][viewport])

Ifboththevalueandviewportargumentsarespecified,thevalueisconvertedtomodelspaceunitsusingthespecifiedviewport.Nouserinputisrequired.

Ifonlythevalueargumentisspecified,thecurrentviewportisassumedandnouserinputisrequired.However,ifthecurrentspaceismodelspace,thereisnocurrentviewportandthefunctionwillfail(returningnil).Ifpaperspaceisthecurrentspace,thefunctionwilleitherpromptforaviewportifmorethanoneviewportexistsinthelayout,orusethesingleexistingviewport.

Ifnoargumentsarespecified,thefunctionpromptsforavalueandconvertsitifpossible.

Arguments

value

Arealvaluetobeconverted.

viewport

Aviewportentityname(ads_name).

ReturnValues

Theconvertedrealvalueonsuccess,nilonfailure.

Pleasesendusyourcommentaboutthispage

Page 53: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

action_tile

Assignsanactiontoevaluatewhentheuserselectsthespecifiedtileinadialogbox

(action_tilekeyaction-expression)

Theactionassignedbyaction_tilesupersedesthedialogbox'sdefaultaction(assignedbynew_dialog)orthetile'sactionattribute,ifthesearespecified.Theexpressioncanrefertothetile'scurrentvalueas$value,itsnameas$key,itsapplication-specificdata(assetbyclient_data_tile)as$data,itscallbackreasonas$reason,anditsimagecoordinates(ifthetileisanimagebutton)as$xand$y.

Arguments

key

Astringthatnamesthetilethattriggerstheaction(specifiedasitskeyattribute).Thisargumentiscase-sensitive.

action-expression

Astringnamingtheexpressionevaluatedwhenthetileisselected.

Note YoucannotcalltheAutoLISPcommandfunctionfromtheaction_tilefunction.

ReturnValues

T

Examples

Ifedit1isatextbox,theactionexpressioninthefollowingaction_tilecallisevaluatedwhentheuserexitsthetextbox:

Page 54: less than or equalAutoLISP Functions

(action_tile"edit1""(setqns$value)")

SeeAlsoTheDefaultandDCLActionstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 55: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

add_list

Addsormodifiesastringinthecurrentlyactivedialogboxlist

(add_liststring)

Beforeusingadd_list,youmustopenthelistandinitializeitwithacalltostart_list.Dependingontheoperationspecifiedinstart_list,thestringiseitheraddedtothecurrentlistorreplacesthecurrentlistitem.

Arguments

string

Astring.

ReturnValues

Returnsthestringaddedtothelist,ifsuccessful;otherwisenil.

Examples

AssumingthecurrentlyactiveDCLfilehasapopup_listorlist_boxwithakeyoflonglist,thefollowingcodefragmentinitializesthelistandaddstoitthetextstringsinllist.

(setqllist'("firstline""secondline""thirdline"))

(start_list"longlist")

(mapcar'add_listllist)

(end_list)

Afterthelisthasbeendefined,thefollowingcodefragmentchangesthetextinthesecondlineto"2ndline".

(start_list"longlist"10)

(add_list"2ndline")

(end_list)

Page 56: less than or equalAutoLISP Functions

SeeAlsoThestart_listandend_listfunctions.

Pleasesendusyourcommentaboutthispage

Page 57: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

alert

Displaysadialogboxcontaininganerrororwarningmessage

(alertstring)

Arguments

string

Thestringtoappearinthealertbox.

ReturnValues

nil

Examples

Displayamessageinanalertbox:

(alert"Thatfunctionisnotavailable.")

Displayamultiplelinemessage,byusingthenewlinecharacterinstring:

(alert"Thatfunction\nisnotavailable.")

Note Linelengthandthenumberoflinesinanalertboxareplatform,device,andwindowdependent.AutoCADtruncatesanystringthatistoolongtofitinsideanalertbox.

Pleasesendusyourcommentaboutthispage

Page 58: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

alloc

Setsthesizeofthesegmenttobeusedbytheexpandfunction

(allocn-alloc)

Arguments

n-alloc

Anintegerindicatingtheamountofmemorytobeallocated.Theintegerrepresentsthenumberofsymbols,strings,usubrs,reals,andconscells.

ReturnValues

Theprevioussettingofn-alloc.

Examples

_$(alloc100)1000

SeeAlsoTheexpandfunction.

Pleasesendusyourcommentaboutthispage

Page 59: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

and

ReturnsthelogicalANDofthesuppliedarguments

(and[expr...])

Arguments

expr

Anyexpression.

ReturnValues

Nil,ifanyoftheexpressionsevaluatetonil;otherwiseT.Ifandisissuedwithoutarguments,itreturnsT.

ExamplesCommand:(setqa103bnilc"string")

"string"

Command:(and1.4ac)

T

Command:(and1.4abc)

nil

Pleasesendusyourcommentaboutthispage

Page 60: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

angle

Returnsanangleinradiansofalinedefinedbytwoendpoints

(anglept1pt2)

Arguments

pt1

Anendpoint.

pt2

Anendpoint.

ReturnValues

Anangle,inradians.

TheangleismeasuredfromtheXaxisofthecurrentconstructionplane,inradians,withanglesincreasinginthecounterclockwisedirection.If3Dpointsaresupplied,theyareprojectedontothecurrentconstructionplane.

ExamplesCommand:(angle'(1.01.0)'(1.04.0))

1.5708

Command:(angle'(5.01.33)'(2.41.33))

3.14159

SeeAlsoTheAngularConversiontopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 61: less than or equalAutoLISP Functions
Page 62: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

angtof

Convertsastringrepresentinganangleintoareal(floating-point)valueinradians

(angtofstring[units])

Arguments

string

Astringdescribingananglebasedontheformatspecifiedbythemodeargument.Thestringmustbeastringthatangtofcanparsecorrectlytothespecifiedunit.Itcanbeinthesameformthatangtosreturns,orinaformthatAutoCADallowsforkeyboardentry.

units

Specifiestheunitsinwhichthestringisformatted.ThevalueshouldcorrespondtovaluesallowedfortheAutoCADsystemvariableAUNITSintheCommandReference.Ifunitisomitted,angtofusesthecurrentvalueofAUNITS.Thefollowingunitsmaybespecified:0--Degrees1--Degrees/minutes/seconds2--Grads3--Radians4--Surveyor'sunits

ReturnValues

Arealvalue,ifsuccessful;otherwisenil.

Theangtofandangtosfunctionsarecomplementary:ifyoupassangtofastringcreatedbyangtos,angtofisguaranteedtoreturnavalidvalue,and

Page 63: less than or equalAutoLISP Functions

viceversa(assumingtheunitvaluesmatch).

ExamplesCommand:(angtof"45.0000")

0.785398

Command:(angtof"45.0000"3)

1.0177

SeeAlsoTheangtosfunction.

Pleasesendusyourcommentaboutthispage

Page 64: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

angtos

Convertsanangularvalueinradiansintoastring

(angtosangle[unit[precision]])

Arguments

angle

Arealnumber,inradians.

unit

Anintegerthatspecifiestheangularunits.Ifunitisomitted,angtosusesthecurrentvalueoftheAutoCADsystemvariableAUNITS.Thefollowingunitsmaybespecified:0--Degrees1--Degrees/minutes/seconds2--Grads3--Radians4--Surveyor'sunits

precision

Anintegerspecifyingthenumberofdecimalplacesofprecisiontobereturned.Ifomitted,angtosusesthecurrentsettingoftheAutoCADsystemvariableAUPRECintheCommandReference.

Theangtosfunctiontakesangleandreturnsiteditedintoastringaccordingtothesettingsofunit,precision,theAutoCADUNITMODEsystemvariable,andtheDIMZINdimensioningvariableintheCommandReference.

Theangtosfunctionacceptsanegativeangleargument,butalwaysreducesittoapositivevaluebetweenzeroand2piradiansbeforeperformingthespecified

Page 65: less than or equalAutoLISP Functions

conversion.

TheUNITMODEsystemvariableaffectsthereturnedstringwhensurveyor'sunitsareselected(aunitvalueof4).IfUNITMODE=0,spacesareincludedinthestring(forexample,“N45dE”);ifUNITMODE=1,nospacesareincludedinthestring(forexample,“N45dE”).

ReturnValues

Astring,ifsuccessful;otherwisenil.

ExamplesCommand:(angtos0.78539804)

"45.0000"

Command:(angtos-0.78539804)

"315.0000"

Command:(angtos-0.7853984)

"S45dE"

Note Routinesthatusetheangtosfunctiontodisplayarbitraryangles(thosenotrelativetothevalueofANGBASE)shouldcheckandconsiderthevalueofANGBASE.

SeeAlsoTheangtoffunction,andStringConversionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 66: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

append

Takesanynumberoflistsandappendsthemtogetherasonelist

(append[list...])

Arguments

list

Alist.

ReturnValues

Alistwithallargumentsappendedtotheoriginal.Ifnoargumentsaresupplied,appendreturnsnil.

ExamplesCommand:(append'(ab)'(cd))

(ABCD)

Command:(append'((a)(b))'((c)(d)))

((A)(B)(C)(D))

Pleasesendusyourcommentaboutthispage

Page 67: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

apply

Passesalistofargumentsto,andexecutes,aspecifiedfunction

(apply'function

list)

Arguments

'function

Afunction.Thefunctionargumentcanbeeitherasymbolidentifyingadefun,oralambdaexpression.

list

Alist.Canbenil,ifthefunctionacceptsnoarguments.

ReturnValues

Theresultofthefunctioncall.

ExamplesCommand:(apply'+'(123))

6

Command:(apply'strcat'("a""b""c"))

"abc"

Pleasesendusyourcommentaboutthispage

Page 68: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

arx

ReturnsalistofthecurrentlyloadedObjectARXapplications

(arx)

ReturnValues

AlistofObjectARX®applicationfilenames;thepathisnotincludedinthefilename.

ExamplesCommand:(arx)

("acadapp.arx""acmted.arx""oleaprot.arx")

SeeAlsoThearxloadandarxunloadfunctions.

Pleasesendusyourcommentaboutthispage

Page 69: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

arxload

LoadsanObjectARXapplication

(arxloadapplication[onfailure])

Arguments

application

Aquotedstringoravariablethatcontainsthenameofanexecutablefile.Youcanomitthe.arxextensionfromthefilename.YoumustsupplythefullpathnameoftheObjectARXexecutablefile,unlessthefileisinadirectorythatisintheAutoCADsupportfilesearchpath.

onfailure

Anexpressiontobeexecutediftheloadfails.

ReturnValues

Theapplicationname,ifsuccessful.Ifunsuccessfulandtheonfailureargumentissupplied,arxloadreturnsthevalueofthisargument;otherwise,failureresultsinanerrormessage.

Ifyouattempttoloadanapplicationthatisalreadyloaded,arxloadissuesanerrormessage.YoumaywanttocheckthecurrentlyloadedObjectARXapplicationswiththearxfunctionbeforeusingarxload.

Examples

Loadtheacbrowse.arxfilesuppliedintheAutoCADinstallationdirectory:Command:(arxload"c:/programfiles/<AutoCADinstallationdirectory>/acbrowse.arx")

"c:/programfiles/<AutoCADinstallationdirectory>/acbrowse.arx"

SeeAlso

Page 70: less than or equalAutoLISP Functions

Thearxunloadfunction.

Pleasesendusyourcommentaboutthispage

Page 71: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

arxunload

UnloadsanObjectARXapplication

(arxunloadapplication[onfailure])

Arguments

application

Aquotedstringoravariablethatcontainsthenameofafilethatwasloadedwiththearxloadfunction.Youcanomitthe.arxextensionandthepathfromthefilename.

onfailure

Anexpressiontobeexecutediftheunloadfails.

ReturnValues

Theapplicationname,ifsuccessful.Ifunsuccessfulandtheonfailureargumentissupplied,arxunloadreturnsthevalueofthisargument;otherwise,failureresultsinanerrormessage.

NotethatlockedObjectARXapplicationscannotbeunloaded.ObjectARXapplicationsarelockedbydefault.

Examples

Unloadtheacbrowseapplicationthatwasloadedinthearxloadfunctionexample:

Command:(arxunload"acbrowse")

"acbrowse"

SeeAlsoThearxloadfunction.

Page 72: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 73: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

ascii

ReturnstheconversionofthefirstcharacterofastringintoitsASCIIcharactercode(aninteger)

(asciistring)

Arguments

string

Astring.

ReturnValues

Aninteger.

ExamplesCommand:(ascii"A")

65

Command:(ascii"a")

97

Command:(ascii"BIG")

66

Pleasesendusyourcommentaboutthispage

Page 74: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

assoc

Searchesanassociationlistforanelementandreturnsthatassociationlistentry

(assocelementalist)

Arguments

element

Keyofanelementinanassociationlist.

alist

Anassociationlisttobesearched.

ReturnValues

Thealistentry,ifsuccessful.Ifassocdoesnotfindelementasakeyinalist,itreturnsnil.

ExamplesCommand:(setqal'((namebox)(width3)(size4.7263)(depth5)))

((NAMEBOX)(WIDTH3)(SIZE4.7263)(DEPTH5))

Command:(assoc'sizeal)

(SIZE4.7263)

Command:(assoc'weightal)

nil

Pleasesendusyourcommentaboutthispage

Page 75: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

atan

Returnsthearctangentofanumberinradians

(atannum1[num2])

Arguments

num1

Anumber.

num2

Anumber.

ReturnValues

Thearctangentofnum1,inradians,ifonlynum1issupplied.Ifyousupplybothnum1andnum2arguments,atanreturnsthearctangentofnum1/num2,inradians.Ifnum2iszero,itreturnsanangleofplusorminus1.570796radians(+90degreesor-90degrees),dependingonthesignof num1.Therangeofanglesreturnedis-pi/2to+pi/2radians.

ExamplesCommand:(atan1)

0.785398

Command:(atan1.0)

0.785398

Command:(atan0.5)

0.463648

Command:(atan1.0)

0.785398

Command:(atan-1.0)

-0.785398

Page 76: less than or equalAutoLISP Functions

Command:(atan2.03.0)

0.588003

Command:(atan2.0-3.0)

2.55359

Command:(atan1.00.0)

1.5708

Pleasesendusyourcommentaboutthispage

Page 77: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

atof

Convertsastringintoarealnumber

(atofstring)

Arguments

string

Astringtobeconvertedintoarealnumber.

ReturnValues

Arealnumber.

ExamplesCommand:(atof"97.1")

97.1

Command:(atof"3")

3.0

Command:(atof"3.9")

3.9

Pleasesendusyourcommentaboutthispage

Page 78: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

atoi

Convertsastringintoaninteger

(atoistring)

Arguments

string

Astringtobeconvertedintoaninteger.

ReturnValues

Aninteger.

ExamplesCommand:(atoi"97")

97

Command:(atoi"3")

3

Command:(atoi"3.9")

3

SeeAlsoTheitoafunction.

Pleasesendusyourcommentaboutthispage

Page 79: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

atom

Verifiesthatanitemisanatom

(atomitem)

Arguments

item

AnyAutoLISPelement.

SomeversionsofLISPdifferintheirinterpretationofatom,sobecarefulwhenconvertingfromnon-AutoLISPcode.

ReturnValues

Nilifitemisalist;otherwiseT.Anythingthatisnotalistisconsideredanatom.

ExamplesCommand:(setqa'(xyz))

(XYZ)

Command:(setqb'a)

A

Command:(atom'a)

T

Command:(atoma)

nil

Command:(atom'b)

T

Command:(atomb)

T

Command:(atom'(abc))

Page 80: less than or equalAutoLISP Functions

nil

Pleasesendusyourcommentaboutthispage

Page 81: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

atoms-family

Returnsalistofthecurrentlydefinedsymbols

(atoms-familyformat[symlist])

Arguments

format

Anintegervalueof0or1thatdeterminestheformatinwhichatoms-familyreturnsthesymbolnames:0 Returnthesymbolnamesasalist1 Returnthesymbolnamesasalistofstrings

symlist

Alistofstringsthatspecifythesymbolnamesyouwantatoms-familytosearchfor.

ReturnValues

Alistofsymbols.Ifyouspecifysymlist,thenatoms-familyreturnsthespecifiedsymbolsthatarecurrentlydefined,andreturnsnilforthosesymbolsthatarenotdefined.

ExamplesCommand:(atoms-family0)

(BNS_PRE_SELFITSTR2LENC:AI_SPHEREALERTDEFUNC:BEXTENDREM_GROUP

B_RESTORE_SYSVARSBNS_CMD_EXITLISPEDFNSPLITL...

ThefollowingcodeverifiesthatthesymbolsCAR,CDR,andXYZaredefined,andreturnsthelistasstrings:

Command:(atoms-family1'("CAR""CDR""XYZ"))

("CAR""CDR"nil)

Page 82: less than or equalAutoLISP Functions

ThereturnvalueshowsthatthesymbolXYZisnotdefined.

Pleasesendusyourcommentaboutthispage

Page 83: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

autoarxload

PredefinescommandnamestoloadanassociatedObjectARXfile

(autoarxloadfilenamecmdlist)

Thefirsttimeauserentersacommandspecifiedincmdlist,AutoCADloadstheObjectARXapplicationspecifiedinfilename,thencontinuesthecommand.

Ifyouassociateacommandwithfilenameandthatcommandisnotdefinedinthespecifiedfile,AutoCADalertsyouwithanerrormessagewhenyouenterthecommand.

Arguments

filename

Astringspecifyingthe.arxfiletobeloadedwhenoneofthecommandsdefinedbythecmdlistargumentisenteredattheCommandprompt.Ifyouomitthepathfromfilename,AutoCADlooksforthefileinthesupportfilesearchpath.

cmdlist

Alistofstrings.

ReturnValues

nil

Examples

ThefollowingcodedefinestheC:APP1,C:APP2,andC:APP3functionstoloadthebonusapp.arxfile:

(autoarxload"BONUSAPP"'("APP1""APP2""APP3"))

Page 84: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 85: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>AFunctions>

autoload

PredefinescommandnamestoloadanassociatedAutoLISPfile

(autoloadfilenamecmdlist)

Thefirsttimeauserentersacommandspecifiedincmdlist,AutoCADloadstheapplicationspecifiedinfilename,thencontinuesthecommand.

Arguments

filename

Astringspecifyingthe.lspfiletobeloadedwhenoneofthecommandsdefinedbythecmdlistargumentisenteredattheCommandprompt.Ifyouomitthepathfromfilename,AutoCADlooksforthefileintheSupportFileSearchPath.

cmdlist

Alistofstrings.

ReturnValues

nil

Ifyouassociateacommandwithfilenameandthatcommandisnotdefinedinthespecifiedfile,AutoCADalertsyouwithanerrormessagewhenyouenterthecommand.

Examples

ThefollowingcausesAutoCADtoloadthebonusapp.lspfilethefirsttimetheAPP1,APP2,orAPP3commandsareenteredattheCommandprompt:

(autoload"BONUSAPP"'("APP1""APP2""APP3"))

Page 86: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 87: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

BFunctions

BooleServesasageneralbitwiseBooleanfunctionboundpVerifiesifavalueisboundtoasymbol

Pleasesendusyourcommentaboutthispage

Page 88: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>BFunctions>

Boole

ServesasageneralbitwiseBooleanfunction

(Booleoperatorint1[int2...])

Arguments

operator

Anintegerbetween0and15representingoneofthe16possibleBooleanfunctionsintwovariables.

int1,int2...

Integers.NotethatBoolewillacceptasingleintegerargument,buttheresultisunpredictable.

Successiveintegerargumentsarebitwise(logically)combinedbasedonthisfunctionandonthefollowingtruthtable:

Booleantruthtable

Int1 Int2 operatorbit

0 0 8

0 1 4

1 0 2

1 1 1

Page 89: less than or equalAutoLISP Functions

Eachbitofint1ispairedwiththecorrespondingbitofint2,specifyingonehorizontalrowofthetruthtable.Theresultingbitiseither0or1,dependingonthesettingoftheoperatorbitthatcorrespondstothisrowofthetruthtable.

Iftheappropriatebitissetinoperator,theresultingbitis1;otherwisetheresultingbitis0.SomeofthevaluesforoperatorareequivalenttothestandardBooleanoperationsAND,OR,XOR,andNOR.

Boolefunctionbitvalues

Operator Operation Resultingbitis1if

1 AND Bothinputbitsare1

6 XOR Onlyoneofthetwoinputbitsis1

7 OR Eitherorbothoftheinputbitsare1

8 NOR Bothinputbitsare0(1'scomplement)

ReturnValues

Aninteger.

Examples

ThefollowingspecifiesalogicalANDofthevalues12and5:Command:(Boole1125)

4

ThefollowingspecifiesalogicalXORofthevalues6and5:Command:(Boole665)

Page 90: less than or equalAutoLISP Functions

3

YoucanuseothervaluesofoperatortoperformotherBooleanoperationsforwhichtherearenostandardnames.Forexample,ifoperatoris4,theresultingbitsaresetifthecorrespondingbitsaresetinint2butnotinint1:

Command:(Boole4314)

12

Pleasesendusyourcommentaboutthispage

Page 91: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>BFunctions>

boundp

Verifiesifavalueisboundtoasymbol

(boundpsym)

Arguments

sym

Asymbol.

ReturnValues

Tifsymhasavalueboundtoit.Ifnovalueisboundtosym,orifithasbeenboundtonil,boundpreturnsnil.Ifsymisanundefinedsymbol,itisautomaticallycreatedandisboundtonil.

ExamplesCommand:(setqa2bnil)

nil

Command:(boundp'a)

T

Command:(boundp'b)

nil

Theatoms-familyfunctionprovidesanalternativemethodofdeterminingtheexistenceofasymbolwithoutautomaticallycreatingthesymbol.

SeeAlsoTheatoms-familyfunction.

Pleasesendusyourcommentaboutthispage

Page 92: less than or equalAutoLISP Functions
Page 93: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

CFunctions

caddrReturnsthethirdelementofalistcadrReturnsthesecondelementofalistcarReturnsthefirstelementofalistcdrReturnsalistcontainingallbutthefirstelementofthespecifiedlistchrConvertsanintegerrepresentinganASCIIcharactercodeintoasingle-characterstringclient_data_tileAssociatesapplication-manageddatawithadialogboxtilecloseClosesanopenfilecommandExecutesanAutoCADcommandcondServesastheprimaryconditionalfunctionforAutoLISPconsAddsanelementtothebeginningofalist,orconstructsadottedlistcosReturnsthecosineofanangleexpressedinradians

Page 94: less than or equalAutoLISP Functions

cvunitConvertsavaluefromoneunitofmeasurementtoanother

Pleasesendusyourcommentaboutthispage

Page 95: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

caddr

Returnsthethirdelementofalist

(caddrlist)

InAutoLISP,caddrisfrequentlyusedtoobtaintheZcoordinateofa3Dpoint(thethirdelementofalistofthreereals).

Arguments

list

Alist.

ReturnValues

Thethirdelementinlist;otherwisenil,ifthelistisemptyorcontainsfewerthanthreeelements.

ExamplesCommand:(setqpt3'(5.251.03.0))

(5.251.03.0)

Command:(caddrpt3)

3.0

Command:(caddr'(5.251.0))

nil

SeeAlsoThePointListstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 96: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cadr

Returnsthesecondelementofalist

(cadrlist)

InAutoLISP,cadrisfrequentlyusedtoobtaintheYcoordinateofa2Dor3Dpoint(thesecondelementofalistoftwoorthreereals).

Arguments

list

Alist.

ReturnValues

Thesecondelementinlist;otherwisenil,ifthelistisemptyorcontainsonlyoneelement.

ExamplesCommand:(setqpt2'(5.251.0))

(5.251.0)

Command:(cadrpt2)

1.0

Command:(cadr'(4.0))

nil

Command:(cadr'(5.251.03.0))

1.0

SeeAlsoThePointListstopicintheAutoLISPDeveloper'sGuide.

Page 97: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 98: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

car

Returnsthefirstelementofalist

(carlist)

Arguments

list

Alist.

ReturnValues

Thefirstelementinlist;otherwisenil,ifthelistisempty.

ExamplesCommand:(car'(abc))

A

Command:(car'((ab)c))

(AB)

Command:(car'())

nil

SeeAlsoThePointListstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 99: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cdr

Returnsalistcontainingallbutthefirstelementofthespecifiedlist

(cdrlist)

Arguments

list

Alist.

ReturnValues

Alistcontainingalltheelementsoflist,exceptthefirstelement(butseeNotebelow).Ifthelistisempty,cdrreturnsnil.

Note Whenthelistargumentisadottedpair,cdrreturnsthesecondelementwithoutenclosingitinalist.

ExamplesCommand:(cdr'(abc))

(BC)

Command:(cdr'((ab)c))

(C)

Command:(cdr'())

nil

Command:(cdr'(a.b))

B

Command:(cdr'(1."Text"))

"Text"

SeeAlso

Page 100: less than or equalAutoLISP Functions

ThePointListstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 101: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

chr

ConvertsanintegerrepresentinganASCIIcharactercodeintoasingle-characterstring

(chrinteger)

Arguments

list

Aninteger.

ReturnValues

AstringcontainingtheASCIIcharactercodeforinteger.Iftheintegerisnotintherangeof1-255,thereturnvalueisunpredictable.

ExamplesCommand:(chr65)

"A"

Command:(chr66)

"B"

Command:(chr97)

"a"

Pleasesendusyourcommentaboutthispage

Page 102: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

client_data_tile

Associatesapplication-manageddatawithadialogboxtile

(client_data_tilekeyclientdata)

Arguments

key

Astringthatspecifiesatile.Thisargumentiscase-sensitive.

clientdata

Astringtobeassociatedwiththekeytile.Anactionexpressionorcallbackfunctioncanrefertothestringas$data.

ReturnValues

nil

Pleasesendusyourcommentaboutthispage

Page 103: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

close

Closesanopenfile

(closefile-desc)

Arguments

file-desc

Afiledescriptorobtainedfromtheopenfunction.

ReturnValues

Niliffile-descisvalid;otherwiseresultsinanerrormessage.

Afteraclose,thefiledescriptorisunchangedbutisnolongervalid.Dataaddedtoanopenfileisnotactuallywrittenuntilthefileisclosed.

Examples

Thefollowingcodecountsthenumberoflinesinthefilesomefile.txtandsetsthevariablectequaltothatnumber:

(setqfil"SOMEFILE.TXT")

(setqx(openfil"r")ct0)

(while(read-linex)

(setqct(1+ct))

)

(closex)

Pleasesendusyourcommentaboutthispage

Page 104: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

command

ExecutesanAutoCADcommand

(command[arguments]...)

Arguments

arguments

AutoCADcommandsandtheiroptions.Theargumentstothecommandfunctioncanbestrings,reals,integers,orpoints,asexpectedbythepromptsequenceoftheexecutedcommand.Anullstring("")isequivalenttopressingENTERonthekeyboard.InvokingcommandwithnoargumentisequivalenttopressingESCandcancelsmostAutoCADcommands.

ThecommandfunctionevaluateseachargumentandsendsittoAutoCADinresponsetosuccessiveprompts.Itsubmitscommandnamesandoptionsasstrings,2Dpointsaslistsoftworeals,and3Dpointsaslistsofthreereals.AutoCADrecognizescommandnamesonlywhenitissuesaCommandprompt.

NotethatifyouissuecommandfromVisualLISP,focusdoesnotchangetotheAutoCADwindow.Ifthecommandrequiresuserinput,you'llseethereturnvalue(nil)intheConsolewindow,butAutoCADwillbewaitingforinput.YoumustmanuallyactivatetheAutoCADwindowandrespondtotheprompts.Untilyoudoso,anysubsequentcommandswillfail.

ReturnValues

nil

Examples

Thefollowingexamplesetstwovariablespt1andpt2equaltotwopoint

Page 105: less than or equalAutoLISP Functions

values1,1and1,5.ItthenusesthecommandfunctiontoissuetheLINEcommandintheCommandReferenceandpassthetwopointvalues.

Command:(setqpt1'(11)pt2'(15))

(15)

Command:(command"line"pt1pt2"")

lineFrompoint:

Topoint:

Topoint:

Command:nil

RestrictionsandNotes

TheAutoCADSKETCHcommandintheCommandReferencereadsthedigitizerdirectlyandthereforecannotbeusedwiththeAutoLISPcommandfunction.IftheSCRIPTcommandisusedwiththecommandfunction,itshouldbethelastfunctioncallintheAutoLISProutine.

Also,ifyouusethecommandfunctioninanacad.lspor.mnlfile,itshouldbecalledonlyfromwithinadefunstatement.UsetheS::STARTUPfunctiontodefinecommandsthatneedtobeissuedimmediatelywhenyoubeginadrawingsession.

ForAutoCADcommandsthatrequiretheselectionofanobject(liketheBREAKandTRIMcommandsintheCommandReference),youcansupplyalistobtainedwithentselinsteadofapointtoselecttheobject.Forexamples,seePassingPickPointstoAutoCADCommandsintheAutoLISPDeveloper'sGuide.

CommandsexecutedfromthecommandfunctionarenotechoedtothecommandlineiftheCMDECHOsystemvariable(accessiblefromsetvarandgetvar)issetto0.

SeeAlsoThevl-cmdffunction.TheCommandSubmissionintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 106: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cond

ServesastheprimaryconditionalfunctionforAutoLISP

(cond[(testresult...)...])

Thecondfunctionacceptsanynumberoflistsasarguments.Itevaluatesthefirstitemineachlist(intheordersupplied)untiloneoftheseitemsreturnsavalueotherthannil.Itthenevaluatesthoseexpressionsthatfollowthetestthatsucceeded.

ReturnValues

Thevalueofthelastexpressioninthesublist.Ifthereisonlyoneexpressioninthesublist(thatis,ifresultismissing),thevalueofthetestexpressionisreturned.Ifnoargumentsaresupplied,condreturnsnil.

Examples

Thefollowingexampleusescondtoperformanabsolutevaluecalculation:

(cond

((minuspa)(-a))

(ta)

)

Ifthevariableaissettothevalue -10,thisreturns10.

Asshown,condcanbeusedasacasetypefunction.ItiscommontouseTasthelast(default)testexpression.Here'sanothersimpleexample.Givenauserresponsestringinthevariables,thisfunctionteststheresponseandreturns1ifitisYory,0ifitisNorn;otherwisenil.

(cond

((=s"Y")1)

((=s"y")1)

Page 107: less than or equalAutoLISP Functions

((=s"N")0)

((=s"n")0)

(tnil)

)

Pleasesendusyourcommentaboutthispage

Page 108: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cons

Addsanelementtothebeginningofalist,orconstructsadottedlist

(consnew-first-elementlist-or-atom)

Arguments

new-first-element

Elementtobeaddedtothebeginningofalist.Thiselementcanbeanatomoralist.

list-or-atom

Alistoranatom.

ReturnValues

Thevaluereturneddependsonthedatatypeoflist-or-atom.Iflist-or-atomisalist,consreturnsthatlistwithnew-first-elementaddedasthefirstiteminthelist.Iflist-or-atomisanatom,consreturnsadottedpairconsistingofnew-first-elementandlist-or-atom.

ExamplesCommand:(cons'a'(bcd))

(ABCD)

Command:(cons'(a)'(bcd))

((A)BCD)

Command:(cons'a2)

(A.2)

SeeAlsoTheListHandlingtopicintheAutoLISPDeveloper'sGuide.

Page 109: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 110: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cos

Returnsthecosineofanangleexpressedinradians

(cosang)

Arguments

ang

Anangle,inradians.

ReturnValues

Thecosineofang,inradians.

ExamplesCommand:(cos0.0)

1.0

Command:(cospi)

-1.0

Pleasesendusyourcommentaboutthispage

Page 111: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>CFunctions>

cvunit

Convertsavaluefromoneunitofmeasurementtoanother

(cvunitvaluefrom-unitto-unit)

Arguments

value

Thenumericvalueorpointlist(2Dor3Dpoint)tobeconverted.

from-unit

Theunitthatvalueisbeingconvertedfrom.

to-unit

Theunitthatvalueisbeingconvertedto.

Thefrom-unitandto-unitargumentscannameanyunittypefoundintheacad.untfile.

ReturnValues

Theconvertedvalue,ifsuccessful;otherwisenil,ifeitherunitnameisunknown(notfoundintheacad.untfile),orifthetwounitsareincompatible(forexample,tryingtoconvertgramsintoyears).

ExamplesCommand:(cvunit1"minute""second")

60.0

Command:(cvunit1"gallon""furlong")

nil

Command:(cvunit1.0"inch""cm")

2.54

Page 112: less than or equalAutoLISP Functions

Command:(cvunit1.0"acre""sqyard")

4840.0

Command:(cvunit'(1.02.5)"ft""in")

(12.030.0)

Command:(cvunit'(123)"ft""in")

(12.024.036.0)

Note Ifyouhaveseveralvaluestoconvertinthesamemanner,itismoreefficienttoconvertthevalue1.0onceandthenapplytheresultingvalueasascalefactorinyourownfunctionorcomputation.Thisworksforallpredefinedunitsexcepttemperature,whereanoffsetisinvolvedaswell.

SeeAlsoTheUnitConversiontopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 113: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

DFunctions

defunDefinesafunctiondefun-qDefinesafunctionasalistdefun-q-list-refDisplaystheliststructureofafunctiondefinedwithdefun-qdefun-q-list-setSetsthevalueofasymboltobeafunctiondefinedbyalistdictaddAddsanongraphicalobjecttothespecifieddictionarydictnextFindsthenextiteminadictionarydictremoveRemovesanentryfromthespecifieddictionarydictrenameRenamesadictionaryentrydictsearchSearchesadictionaryforanitemdimx_tileRetrievesthewidthofatileindialogboxunitsdimy_tileRetrievestheheightofatileindialogboxunitsdistance

Page 114: less than or equalAutoLISP Functions

Returnsthe3DdistancebetweentwopointsdistofConvertsastringthatrepresentsareal(floating-point)valueintoarealvaluedone_dialogTerminatesadialogbox

Pleasesendusyourcommentaboutthispage

Page 115: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

defun

Definesafunction

(defunsym([arguments][/variables...])expr...)

Arguments

sym

Asymbolnamingthefunction.

arguments

Thenamesofargumentsexpectedbythefunction.

/variables

Thenamesofoneormorelocalvariablesforthefunction.Theslashprecedingthevariablenamesmustbeseparatedfromthefirstlocalnameandfromthelastargument,ifany,byatleastonespace.

expr

AnynumberofAutoLISPexpressionstobeevaluatedwhenthefunctionexecutes.

Ifyoudonotdeclareanyargumentsorlocalsymbols,youmustsupplyanemptysetofparenthesesafterthefunctionname.

Ifduplicateargumentorsymbolnamesarespecified,AutoLISPusesthefirstoccurrenceofeachnameandignoresthefollowingoccurrences.

ReturnValues

Theresultofthelastexpressionevaluated.

Warning Neverusethenameofabuilt-infunctionorsymbolforthesym

Page 116: less than or equalAutoLISP Functions

argumenttodefun.Thisoverwritestheoriginaldefinitionandmakesthebuilt-infunctionorsymbolinaccessible.Togetalistofbuilt-inandpreviouslydefinedfunctions,usetheatoms-familyfunction.

Examples

(defunmyfunc(xy)...)Functiontakestwoarguments

(defunmyfunc(/ab)...)Functionhastwolocalvariables

(defunmyfunc(x/temp)...)Oneargument,onelocalvariable

(defunmyfunc()...)Noargumentsorlocalvariables

SeeAlsoTheSymbolandFunctionHandlingtopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 117: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

defun-q

Definesafunctionasalist

(defun-qsym([arguments][/variables...])expr...)

Thedefun-qfunctionisprovidedstrictlyforbackward-compatibilitywithpreviousversionsofAutoLISP,andshouldnotbeusedforotherpurposes.Youcanusedefun-qinsituationswhereyouneedtoaccessafunctiondefinitionasaliststructure,whichisthewaydefunwasimplementedinprevious,non-compiledversionsofAutoLISP.

Arguments

sym

Asymbolnamingthefunction.

arguments

Thenamesofargumentsexpectedbythefunction.

/variables

Thenamesofoneormorelocalvariablesforthefunction.Theslashprecedingthevariablenamesmustbeseparatedfromthefirstlocalnameandfromthelastargument,ifany,byatleastonespace.

expr

AnynumberofAutoLISPexpressionstobeevaluatedwhenthefunctionexecutes.

Ifyoudonotdeclareanyargumentsorlocalsymbols,youmustsupplyanemptysetofparenthesesafterthefunctionname.

Ifduplicateargumentorsymbolnamesarespecified,AutoLISPusesthefirst

Page 118: less than or equalAutoLISP Functions

occurrenceofeachnameandignoresthefollowingoccurrences.

ReturnValues

Theresultofthelastexpressionevaluated.

Examples

_$(defun-qmy-startup(x)

(print(listx)))MY-STARTUP

_$(my-startup5)(5)(5)

Usedefun-q-list-reftodisplaytheliststructureofmy-startup:

_$(defun-q-list-ref'my-startup)((X)(PRINT(LISTX)))

SeeAlsoThedefun-q-list-refanddefun-q-list-setfunctions.

Pleasesendusyourcommentaboutthispage

Page 119: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

defun-q-list-ref

Displaystheliststructureofafunctiondefinedwithdefun-q

(defun-q-list-ref'function)

Arguments

function

Asymbolnamingthefunction.

ReturnValues

Thelistdefinitionofthefunction;otherwisenil,iftheargumentisnotalist.

Examples

Defineafunctionusingdefun-q:

_$(defun-qmy-startup(x)

(print(listx)))MY-STARTUP

Usedefun-q-list-reftodisplaytheliststructureofmy-startup:

_$(defun-q-list-ref'my-startup)((X)(PRINT(LISTX)))

SeeAlsoThedefun-qanddefun-q-list-setfunctions.

Pleasesendusyourcommentaboutthispage

Page 120: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

defun-q-list-set

Setsthevalueofasymboltobeafunctiondefinedbyalist

(defun-q-list-set'sym

list)

Arguments

sym

Asymbolnamingthefunction

list

Alistcontainingtheexpressionstobeincludedinthefunction.

ReturnValues

Thesymdefined.

Examples

_$(defun-q-list-set'foo

'((x)x))FOO

_$(foo3)3

Thefollowingexampleillustratestheuseofdefun-q-list-settocombinetwofunctionsintoasinglefunction.First,fromtheVisualLISPConsolewindow,definetwofunctionswithdefun-q:

_$(defun-qs::startup(x)

(printx))S::STARTUP

Page 121: less than or equalAutoLISP Functions

_$(defun-qmy-startup(x)

(print(listx)))MY-STARTUP

Usedefun-q-list-settocombinethefunctionsintoasinglefunction:

_$(defun-q-list-set's::startup

(append

(defun-q-list-ref's::startup)

(cdr(defun-q-list-ref

'my-startup))))S::STARTUP

Thefollowingillustrateshowthefunctionsrespondindividually,andhowthefunctionsworkafterbeingcombinedusingdefun-q-list-set:

_$(defun-qfoo(x)(print

(list'foox)))FOO

_$(foo1)(FOO1)(FOO1)

_$(defun-qbar(x)(print

(list'barx)))BAR

_$(bar2)(BAR2)(BAR2)

_$(defun-q-list-set

'foo

(append(defun-q-list-ref

'foo)

(cdr(defun-q-list-ref

'bar))

))FOO

_$(foo3)(FOO3)

(BAR3)(BAR3)

SeeAlsoThedefun-qanddefun-q-list-reffunctions.

Page 122: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 123: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dictadd

Addsanongraphicalobjecttothespecifieddictionary

(dictaddenamesymbolnewobj)

Arguments

ename

Nameofthedictionarytheobjectisbeingaddedto.

symbol

Thekeynameoftheobjectbeingaddedtothedictionary;symbolmustbeauniquenamethatdoesnotalreadyexistinthedictionary.

newobj

Anongraphicalobjecttobeaddedtothedictionary.

Asageneralrule,eachobjectaddedtoadictionarymustbeuniquetothatdictionary.Thisisspecificallyaproblemwhenaddinggroupobjectstothegroupdictionary.Addingthesamegroupobjectusingdifferentkeynamesresultsinduplicategroupnames,whichcansendthedictnextfunctionintoaninfiniteloop.

Note ToaccessdrawingpropertiessuchasTitle,Subject,Author,andKeywords,theIAcadSummaryInfointerface,accessibleasapropertyoftheDocumentobjectintheAutoCADobjectmodel,mustbeused.

ReturnValues

Theentitynameoftheobjectaddedtothedictionary.

Examples

Theexamplesthatfollowcreateobjectsandaddthemtothenamedobject

Page 124: less than or equalAutoLISP Functions

dictionary.

Createadictionaryentrylist:Command:(setqdictionary(list'(0."DICTIONARY")'(100."AcDbDictionary")))

((0."DICTIONARY")(100."AcDbDictionary"))

Createadictionaryobjectusingtheentmakexfunction:Command:(setqxname(entmakexdictionary))

<Entityname:1d98950>

Addthedictionarytothenamedobjectdictionary:Command:(setqnewdict(dictadd(namedobjdict)"MY_WAY_COOL_DICTIONARY"xname))

<Entityname:1d98950>

CreateanXrecordlist:Command:(setqdatalist(append(list'(0."XRECORD")'(100."AcDbXrecord"))'((1."Thisismydata")(101.2.3.)(70.33))))

((0."XRECORD")(100."AcDbXrecord")(1."Thisismydata")(101.02.03.0)(70.33))

MakeanXrecordobject:Command:(setqxname(entmakexdatalist))

<Entityname:1d98958>

AddtheXrecordobjecttothedictionary:Command:(dictaddnewdict"DATA_RECORD_1"xname)

<Entityname:1d98958>

SeeAlsoThedictnext,dictremove,dictrename,dictsearch,andnamedobjdictfunctions.

Pleasesendusyourcommentaboutthispage

Page 125: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dictnext

Findsthenextiteminadictionary

(dictnextename[rewind])

Arguments

ename

Nameofthedictionarybeingviewed.

rewind

Ifthisargumentispresentandisnotnil,thedictionaryisrewoundandthefirstentryinitisretrieved.

ReturnValues

Thenextentryinthespecifieddictionary;otherwisenil,whentheendofthedictionaryisreached.EntriesarereturnedaslistsofdottedpairsofDXF-typecodesandvalues.Deleteddictionaryentriesarenotreturned.

Thedictsearchfunctionspecifiestheinitialentryretrieved.

Usenamedobjdicttoobtainthemasterdictionaryentityname.

Note Onceyoubeginsteppingthroughthecontentsofadictionary,passingadifferentdictionarynametodictnextwillcausetheplacetobelostintheoriginaldictionary.Inotherwords,onlyoneglobaliteratorismaintainedforuseinthisfunction.

Examples

Createadictionaryandanentryasshownintheexamplefordictadd.ThenmakeanotherXrecordobject:

Command:(setqxname(entmakexdatalist))

Page 126: less than or equalAutoLISP Functions

<Entityname:1b62d60>

AddthisXrecordobjecttothedictionary,asthesecondrecordinthedictionary:Command:(dictaddnewdict"DATA_RECORD_2"xname)

<Entityname:1b62d60>

Returntheentitynameofthenextentryinthedictionary:Command:(cdr(car(dictnextnewdict)))

<Entityname:1bac958>

dictnextreturnsthenameofthefirstentityaddedtothedictionary.

Returntheentitynameofthenextentryinthedictionary:Command:(cdr(car(dictnextnewdict)))

<Entityname:1bac960>

dictnextreturnsthenameofthesecondentityaddedtothedictionary.

Returntheentitynameofthenextentryinthedictionary:Command:(cdr(car(dictnextnewdict)))

nil

Therearenomoreentriesinthedictionary,sodictnextreturnsnil.

Rewindtothefirstentryinthedictionaryandreturntheentitynameofthatentry:

Command:(cdr(car(dictnextnewdictT)))

<Entityname:1bac958>

SpecifyingTfortheoptionalrewindargumentcausesdictnexttoreturnthefirstentryinthedictionary.

SeeAlsoThedictadd,dictremove,dictrename,dictsearch,andnamedobjdictfunctions.

Pleasesendusyourcommentaboutthispage

Page 127: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dictremove

Removesanentryfromthespecifieddictionary

(dictremoveenamesymbol)

Bydefault,removinganentryfromadictionarydoesnotdeleteitfromthedatabase.Thismustbedonewithacalltoentdel.Currently,theexceptionstothisrulearegroupsandmlinestyles.Thecodethatimplementsthesefeaturesrequiresthatthedatabaseandthesedictionariesbeuptodateand,therefore,automaticallydeletestheentitywhenitisremoved(withdictremove)fromthedictionary.

Arguments

ename

Nameofthedictionarybeingmodified.

symbol

Theentrytoberemovedfromename.

Thedictremovefunctiondoesnotallowtheremovalofanmlinestylefromthemlinestyledictionaryifitisactivelyreferencedbyanmlineinthedatabase.

ReturnValues

Theentitynameoftheremovedentry.Ifenameisinvalidorsymbolisnotfound,dictremovereturnsnil.

Examples

Thefollowingexampleremovesthedictionarycreatedinthedictaddexample:

Command:(dictremove(namedobjdict)"my_way_cool_dictionary")

Page 128: less than or equalAutoLISP Functions

<Entityname:1d98950>

SeeAlsoThedictadd,dictnext,dictrename,dictsearch,andnamedobjdictfunctions.

Pleasesendusyourcommentaboutthispage

Page 129: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dictrename

Renamesadictionaryentry

(dictrenameenameoldsymnewsym)

Arguments

ename

Nameofthedictionarybeingmodified.

oldsym

Originalkeynameoftheentry.

newsym

Newkeynameoftheentry.

ReturnValues

Thenewsymvalue,iftherenameissuccessful.Iftheoldnameisnotpresentinthedictionary,orifenameornewnameisinvalid,orifnewnameisalreadypresentinthedictionary,thendictrenamereturnsnil.

Examples

Thefollowingexamplerenamesthedictionarycreatedinthedictaddsample:Command:(dictrename(namedobjdict)"my_way_cool_dictionary""Anevencoolerdictionary")

"Anevencoolerdictionary"

SeeAlsoThedictadd,dictnext,dictremove,dictsearch,andnamedobjdictfunctions.

Page 130: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 131: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dictsearch

Searchesadictionaryforanitem

(dictsearchenamesymbol[setnext])

Arguments

ename

Nameofthedictionarybeingsearched.

symbol

Astringthatspecifiestheitemtobesearchedforwithinthedictionary.

setnext

Ifpresentandnotnil,thedictnextentrycounterisadjustedsothefollowingdictnextcallreturnstheentryaftertheonereturnedbythisdictsearchcall.

ReturnValues

Theentryforthespecifieditem,ifsuccessful;otherwisenil,ifnoentryisfound.

Examples

Thefollowingexampleillustratestheuseofdictsearchtoobtainthedictionaryaddedinthedictaddexample:

Command:(setqnewdictlist(dictsearch(namedobjdict)"my_way_cool_dictionary"))

((-1.<Entityname:1d98950>)(0."DICTIONARY")(5."52")(102."{ACAD_REACTORS")(330.<Entityname:1d98860>)(102."}")(330.<Entityname:1d98860>)(100."AcDbDictionary")(280.0)(281.1)(3."DATA_RECORD_1")(350.<Entityname:1d98958>))

SeeAlso

Page 132: less than or equalAutoLISP Functions

Thedictadd,dictnext,dictremove,andnamedobjdictfunctions.

Pleasesendusyourcommentaboutthispage

Page 133: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dimx_tile

Retrievesthewidthofatileindialogboxunits

(dimx_tilekey)

Arguments

key

Astringspecifyingthetiletobequeried.Thekeyargumentiscase-sensitive.

ReturnValues

Thewidthofthetile.

Thecoordinatesreturnedarethemaximumallowedwithinthetile.Becausecoordinatesarezerobased,thisfunctionreturnsonelessthanthetotalXdimension(X-1).Thedimx_tileanddimy_tilefunctionsareprovidedforusewithvector_image,fill_image,andslide_image,whichrequirethatyouspecifyabsolutetilecoordinates.

Examples

(setqtile_width(dimx_tile"my_tile"))

Pleasesendusyourcommentaboutthispage

Page 134: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

dimy_tile

Retrievestheheightofatileindialogboxunits

(dimy_tilekey)

Arguments

key

Astringspecifyingthetiletobequeried.Thekeyargumentiscase-sensitive.

ReturnValues

Theheightofthetile.

Thecoordinatesreturnedarethemaximumallowedwithinthetile.Becausecoordinatesarezerobased,thisfunctionreturnsonelessthanthetotalYdimension(Y-1).Thedimx_tileanddimy_tilefunctionsareprovidedforusewithvector_image,fill_image,andslide_image,whichrequirethatyouspecifyabsolutetilecoordinates.

Examples

(setqtile_height(dimy_tile"my_tile"))

Pleasesendusyourcommentaboutthispage

Page 135: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

distance

Returnsthe3Ddistancebetweentwopoints

(distancept1pt2)

Arguments

pt1

A2Dor3Dpointlist.

pt1

A2Dor3Dpointlist.

ReturnValues

Thedistance.

Ifoneorbothofthesuppliedpointsisa2Dpoint,thendistanceignorestheZcoordinatesofany3Dpointssuppliedandreturnsthe2Ddistancebetweenthepointsasprojectedintothecurrentconstructionplane.

ExamplesCommand:(distance'(1.02.53.0)'(7.72.53.0))

6.7

Command:(distance'(1.02.00.5)'(3.04.00.5))

2.82843

SeeAlsoTheGeometricUtilitiestopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 136: less than or equalAutoLISP Functions
Page 137: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

distof

Convertsastringthatrepresentsareal(floating-point)valueintoarealvalue

(distofstring[mode])

Thedistofandrtosfunctionsarecomplementary.Ifyoupassdistofastringcreatedbyrtos,distofisguaranteedtoreturnavalidvalue,andviceversa(assumingthemodevaluesarethesame).

Arguments

string

Astringtobeconverted.Theargumentmustbeastringthatdistofcanparsecorrectlyaccordingtotheunitsspecifiedbymode.Itcanbeinthesameformthatrtosreturns,orinaformthatAutoCADallowsforkeyboardentry.

mode

Theunitsinwhichthestringiscurrentlyformatted.ThemodecorrespondstothevaluesallowedfortheAutoCADsystemvariableLUNITSintheCommandReference.Specifyoneofthefollowingnumbersformode:1 Scientific2 Decimal3 Engineering(feetanddecimalinches)4 Architectural(feetandfractionalinches)5 Fractional

ReturnValues

Arealnumber,ifsuccessful;otherwisenil.

Note Thedistoffunctiontreatsmodes3and4thesame.Thatis,ifmode

Page 138: less than or equalAutoLISP Functions

specifies3(engineering)or4(architectural)units,andstringisineitheroftheseformats,distofreturnsthecorrectrealvalue.

Pleasesendusyourcommentaboutthispage

Page 139: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>DFunctions>

done_dialog

Terminatesadialogbox

(done_dialog[status])

Arguments

status

Apositiveintegerthatstart_dialogwillreturninsteadofreturning1forOKor0forCancel.Themeaningofanystatusvaluegreaterthan1isdeterminedbyyourapplication.

Youmustcalldone_dialogfromwithinanactionexpressionorcallbackfunction(see).

ReturnValues

Atwo-dimensionalpointlistthatisthe(X,Y)locationofthedialogboxwhentheuserexitedit.

UsageNotes

Ifyouprovideacallbackforthebuttonwhosekeyis"accept"or"cancel"(usuallytheOKandCancelbuttons),thecallbackmustcalldone_dialogexplicitly.Ifitdoesn't,theusercanbetrappedinthedialogbox.Ifyoudon'tprovideanexplicitcallbackforthesebuttonsandusethestandardexitbuttons,AutoCADhandlesthemautomatically.Also,anexplicitAutoLISPactionforthe“accept”buttonmustspecifyastatusof1(oranapplication-definedvalue);otherwise,start_dialogreturnsthedefaultvalue,0,whichmakesitappearasifthedialogboxwascanceled.

Pleasesendusyourcommentaboutthispage

Page 140: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

EFunctions

end_imageEndscreationofthecurrentlyactivedialogboximageend_listEndsprocessingofthecurrentlyactivedialogboxlistentdelDeletesobjects(entities)orrestorespreviouslydeletedobjectsentgetRetrievesanobject's(entity's)definitiondataentlastReturnsthenameofthelastnondeletedmainobject(entity)inthedrawingentmakeCreatesanewentityinthedrawingentmakexMakesanewobjectorentity,givesitahandleandentityname(butdoesnotassignanowner),andthenreturnsthenewentitynameentmodModifiesthedefinitiondataofanobject(entity)entnextReturnsthenameofthenextobject(entity)inthedrawingentselPromptstheusertoselectasingleobject(entity)byspecifyingapointentupd

Page 141: less than or equalAutoLISP Functions

Updatesthescreenimageofanobject(entity)eqDetermineswhethertwoexpressionsareidenticalequalDetermineswhethertwoexpressionsareequal*error*Auser-definableerror-handlingfunctionevalReturnstheresultofevaluatinganAutoLISPexpressionexitForcesthecurrentapplicationtoquitexpReturnstheconstante(arealnumber)raisedtoaspecifiedpower(thenaturalantilog)expandAllocatesadditionalmemoryforAutoLISPexptReturnsanumberraisedtoaspecifiedpower

Pleasesendusyourcommentaboutthispage

Page 142: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

end_image

Endscreationofthecurrentlyactivedialogboximage

(end_image)

Thisfunctionisthecomplementofstart_image.

ReturnValues

nil

SeeAlsoThestart_imagefunction.

Pleasesendusyourcommentaboutthispage

Page 143: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

end_list

Endsprocessingofthecurrentlyactivedialogboxlist

(end_list)

Thisfunctionisthecomplementofstart_list.

ReturnValues

nil

SeeAlsoTheadd_listandstart_listfunctions.

Pleasesendusyourcommentaboutthispage

Page 144: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entdel

Deletesobjects(entities)orrestorespreviouslydeletedobjects

(entdelename)

Theentityspecifiedbyenameisdeletedifitiscurrentlyinthedrawing.Theentdelfunctionrestorestheentitytothedrawingifithasbeendeletedpreviouslyinthiseditingsession.Deletedentitiesarepurgedfromthedrawingwhenthedrawingisexited.Theentdelfunctioncandeletebothgraphicalandnongraphicalentities.

Arguments

ename

Nameoftheentitytobedeletedorrestored.

ReturnValues

Theentityname.

UsageNotes

Theentdelfunctionoperatesonlyonmainentities.Attributesandpolylineverticescannotbedeletedindependentlyoftheirparententities.YoucanusethecommandfunctiontooperatetheATTEDITorPEDITcommandintheCommandReferencetomodifysubentities.

Youcannotdeleteentitieswithinablockdefinition.However,youcancompletelyredefineablockdefinition,minustheentityyouwantdeleted,withentmake.

Examples

Getthenameofthefirstentityinthedrawingandassignittovariablee1:

Page 145: less than or equalAutoLISP Functions

Command:(setqe1(entnext))

<Entityname:2c90520>

Deletetheentitynamedbye1:Command:(entdele1)

<Entityname:2c90520>

Restoretheentitynamedbye1:Command:(entdele1)

<Entityname:2c90520>

SeeAlsoThehandentfunction.

Pleasesendusyourcommentaboutthispage

Page 146: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entget

Retrievesanobject's(entity's)definitiondata

(entgetename[applist])

Arguments

ename

Nameoftheentitybeingqueried.Theenamecanrefertoeitheragraphicaloranongraphicalentity.

applist

Alistofregisteredapplicationnames.

ReturnValues

Anassociationlistcontainingtheentitydefinitionofename.Ifyouspecifytheoptionalapplistargument,entgetalsoreturnstheextendeddataassociatedwiththespecifiedapplications.ObjectsinthelistareassignedAutoCADDXF™groupcodesforeachpartoftheentitydata.

NotethattheDXFgroupcodesusedbyAutoLISPdifferslightlyfromthegroupcodesinaDXFfile.TheAutoLISPDXFgroupcodesaredocumentedintheDXFReference.

Examples

Assumethatthelastobjectcreatedinthedrawingisalinedrawnfrompoint(1,2)topoint(6,5).Thefollowingexampleshowscodethatretrievestheentitynameofthelastobjectwiththeentlastfunction,andpassesthatnametoentget:

Command:(entget(entlast))

((-1.<Entityname:1bbd1d0>)(0."LINE")(330.<Entityname:1bbd0c8>)(5."6A")(100.

Page 147: less than or equalAutoLISP Functions

"AcDbEntity")(67.0)(410."Model")(8."0")(100."AcDbLine")(101.02.00.0)(116.05.00.0)(2100.00.01.0))

SeeAlsoTheentdel,entlast,entmod,entmake,entnext,entupd,andhandentfunctions.TheEntityDataFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 148: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entlast

Returnsthenameofthelastnondeletedmainobject(entity)inthedrawing

(entlast)

Theentlastfunctionisfrequentlyusedtoobtainthenameofanewentitythathasjustbeenaddedwiththecommandfunction.Tobeselected,theentityneednotbeonthescreenoronathawedlayer.

ReturnValues

Anentityname;otherwisenil,iftherearenoentitiesinthecurrentdrawing.

Examples

Setvariablee1tothenameofthelastentityaddedtothedrawing:Command:(setqe1(entlast))

<Entityname:2c90538>

Ifyourapplicationrequiresthenameofthelastnondeletedentity(mainentityorsubentity),defineafunctionsuchasthefollowingandcallitinsteadofentlast.

(defunlastent(/ab)

(if(setqa(entlast))Getslastmainentity

(while(setqb(entnexta))Ifsubentitiesfollow,loops

untiltherearenomore

(setqab)subentities

)

)

aReturnslastmainentity

)orsubentity

SeeAlsoTheentdel,entget,entmod,entnext,entsel,andhandentfunctions.

Page 149: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 150: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entmake

Createsanewentityinthedrawing

(entmake[elist])

Theentmakefunctioncandefinebothgraphicalandnongraphicalentities.

Arguments

elist

Alistofentitydefinitiondatainaformatsimilartothatreturnedbytheentgetfunction.Theelistargumentmustcontainalloftheinformationnecessarytodefinetheentity.Ifanyrequireddefinitiondataisomitted,entmakereturnsnilandtheentityisrejected.Ifyouomitoptionaldefinitiondata(suchasthelayer),entmakeusesthedefaultvalue.Theentitytype(forexample,CIRCLEorLINE)mustbethefirstorsecondfieldoftheelist.Ifentitytypeisthesecondfield,itcanbeprecededonlybytheentityname.Theentmakefunctionignorestheentitynamewhencreatingthenewentity.Iftheelistcontainsanentityhandle,entmakeignoresthattoo.

ReturnValues

Ifsuccessful,entmakereturnstheentity'slistofdefinitiondata.Ifentmakeisunabletocreatetheentity,itreturnsnil.

Completionofablockdefinition(entmakeofanendblk)returnstheblock'snameratherthantheentitydatalistnormallyreturned.

Examples

Thefollowingcodecreatesaredcircle(color62),centeredat(4,4)witharadiusof1.Theoptionallayerandlinetypefieldshavebeenomittedandtherefore

Page 151: less than or equalAutoLISP Functions

assumedefaultvalues.Command:(entmake'((0."CIRCLE")(62.1)(104.04.00.0)(40.1.0)))

((0."CIRCLE")(62.1)(104.04.00.0)(40.1.0))

NotesonUsingentmake

Youcannotcreateviewportobjectswithentmake.

Agroup66codeishonoredonlyforinsertobjects(meaningattributesfollow).Forpolylineentities,thegroup66codeisforcedtoavalueof1(meaningverticesfollow),andforallotherentitiesittakesadefaultof0.Theonlyentitythatcanfollowapolylineentityisavertexentity.

Thegroupcode2(blockname)ofadimensionentityisoptionalfortheentmakefunction.Iftheblocknameisomittedfromtheentitydefinitionlist,AutoCADcreatesanewone.Otherwise,AutoCADcreatesthedimensionusingthenameprovided.

Forlegacyreasons,entmakeignoresDXFgroupcode100dataforthefollowingentitytypes:

AcDbText

AcDbAttribute

AcDbAttributeDefinition

AcDbBlockBegin

AcDbBlockEnd

AcDbSequenceEnd

AcDbBlockReference

AcDbMInsertBlock

AcDb2dVertex

AcDb3dPolylineVertex

AcDbPolygonMeshVertex

AcDbPolyFaceMeshVertex

AcDbFaceRecord

Page 152: less than or equalAutoLISP Functions

AcDb2dPolyline

AcDb3dPolyline

AcDbArc

AcDbCircle

AcDbLine

AcDbPoint

AcDbFace

AcDbPolyFaceMesh

AcDbPolygonMesh

AcDbTrace

AcDbSolid

AcDbShape

AcDbViewport

SeeAlsoTheentdel,entget,entmod,andhandentfunctions.IntheAutoLISPDeveloper'sGuide,refertoEntityDataFunctionsforadditionalinformationoncreatingentitiesinadrawing,AddinganEntitytoaDrawingforspecificsonusingentmake,andCreatingComplexEntitiesforinformationoncreatingcomplexentities.

Pleasesendusyourcommentaboutthispage

Page 153: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entmakex

Makesanewobjectorentity,givesitahandleandentityname(butdoesnotassignanowner),andthenreturnsthenewentityname

(entmakex[elist])

Theentmakexfunctioncandefinebothgraphicalandnongraphicalentities.

Arguments

elist

Alistofentitydefinitiondatainaformatsimilartothatreturnedbytheentgetfunction.Theelistargumentmustcontainalloftheinformationnecessarytodefinetheentity.Ifanyrequireddefinitiondataisomitted,entmakexreturnsnilandtheentityisrejected.Ifyouomitoptionaldefinitiondata(suchasthelayer),entmakexusesthedefaultvalue.

ReturnValues

Ifsuccessful,entmakexreturnsthenameoftheentitycreated.Ifentmakexisunabletocreatetheentity,thefunctionreturnsnil.

Examples

_$(entmakex'((0."CIRCLE")

(62.1)(104.03.00.0)(40.1.0)))<Entityname:1d45558>

Warning ObjectsandentitieswithoutownersarenotwrittenouttoDWGorDXFfiles.Besuretosetanowneratsomepointafterusingentmakex.Forexample,youcanusedictaddtosetadictionarytoownanobject.

SeeAlso

Page 154: less than or equalAutoLISP Functions

Theentmakeandhandentfunctions.

Pleasesendusyourcommentaboutthispage

Page 155: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entmod

Modifiesthedefinitiondataofanobject(entity)

(entmodelist)

Theentmodfunctionupdatesdatabaseinformationfortheentitynamespecifiedbythe-1groupinelist.TheprimarymechanismthroughwhichAutoLISPupdatesthedatabaseisbyretrievingentitieswithentget,modifyingthelistdefininganentity,andupdatingtheentityinthedatabasewithentmod.Theentmodfunctioncanmodifybothgraphicalandnongraphicalobjects.

Arguments

elist

Alistofentitydefinitiondatainaformatsimilartothatreturnedbytheentgetfunction.Forentityfieldswithfloating-pointvalues(suchasthickness),entmodacceptsintegervaluesandconvertsthemtofloatingpoint.Similarly,ifyousupplyafloating-pointvalueforanintegerentityfield(suchascolornumber),entmodtruncatesitandconvertsittoaninteger.

ReturnValues

Ifsuccessful,entmodreturnstheelistsuppliedtoit.Ifentmodisunabletomodifythespecifiedentity,thefunctionreturnsnil.

Examples

Thefollowingsequenceofcommandsobtainsthepropertiesofanentity,andthenmodifiestheentity.

Settheen1variabletothenameofthefirstentityinthedrawing:Command:(setqen1(entnext))

Page 156: less than or equalAutoLISP Functions

<Entityname:2c90520>

Setavariablenamededtotheentitydataofentityen1:Command:(setqed(entgeten1))

((-1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")(67.0)(8."0")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)(2100.00.01.0))

Changesthelayergroupinedfromlayer0tolayer1:Command:(setqed(subst(cons8"1")(assoc8ed)ed))

((-1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")(67.0)(8."1")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)(2100.00.01.0))

Modifythelayeroftheen1entityinthedrawing:Command:(entmoded)

((-1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")(67.0)(8."1")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)(2100.00.01.0))

RestrictionsonUsingentmod

Therearerestrictionsonthechangestheentmodfunctioncanmake:

Anentity'stypeandhandlecannotbechanged.Ifyouwanttodothis,useentdeltodeletetheentity,andthenmakeanewentitywiththecommandorentmakefunction.

Theentmodfunctioncannotchangeinternalfields,suchastheentitynameinthe-2groupofaseqendentity.Attemptstochangesuchfieldsareignored.

Youcannotusetheentmodfunctiontomodifyaviewportentity.

Youcanchangeanentity'sspacevisibilityfieldto0or1(exceptforviewportobjects).Ifyouuseentmodtomodifyanentitywithinablockdefinition,themodificationaffectsallinstancesoftheblockinthedrawing.

Beforeperforminganentmodonvertexentities,youshouldreadorwritethepolylineentity'sheader.Ifthemostrecentlyprocessedpolylineentityisdifferentfromtheonetowhichthevertexbelongs,widthinformation(the40and41groups)canbelost.

Warning Youcanuseentmodtomodifyentitieswithinablockdefinition,butdoingsocancreateaself-referencingblock,whichwillcauseAutoCADtostop.

Page 157: less than or equalAutoLISP Functions

SeeAlsoTheentdel,entget,entmake,entnext,andhandentfunctions.IntheAutoLISPDeveloper'sGuide,refertoModifyinganEntityandEntityDataFunctionsandtheGraphicsScreen.

Pleasesendusyourcommentaboutthispage

Page 158: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entnext

Returnsthenameofthenextobject(entity)inthedrawing

(entnext[ename])

Arguments

ename

Thenameofanexistingentity.

ReturnValues

Ifentnextiscalledwithnoarguments,itreturnstheentitynameofthefirstnondeletedentityinthedatabase.Ifanenameargumentissuppliedtoentnext,thefunctionreturnstheentitynameofthefirstnondeletedentityfollowingenameinthedatabase.Ifthereisnonextentityinthedatabase,itreturnsnil.Theentnextfunctionreturnsbothmainentitiesandsubentities.

Examples

(setqe1(entnext)) ;Setse1tothenameofthefirst

entityinthedrawing

(setqe2(entnexte1)) ;Setse2tothenameoftheentityfollowing

Notes

Theentitiesselectedbyssgetaremainentities,notattributesofblocksorverticesofpolylines.Youcanaccesstheinternalstructureofthesecomplexentitiesbywalkingthroughthesubentitieswithentnext.Onceyouobtainasubentity'sname,youcanoperateonitlikeanyotherentity.Ifyouobtainthenameofasubentitywithentnext,youcanfindtheparententitybysteppingforwardwithentnextuntilaseqendentityisfound,thenextractingthe-2groupfromthatentity,whichisthemainentity'sname.

Page 159: less than or equalAutoLISP Functions

SeeAlsoTheentdel,entget,entmake,entnext,andhandentfunctions.

Pleasesendusyourcommentaboutthispage

Page 160: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entsel

Promptstheusertoselectasingleobject(entity)byspecifyingapoint

(entsel[msg])

Arguments

msg

Apromptstringtobedisplayedtousers.Ifomitted,entselpromptswiththemessage,"Selectobject."

ReturnValues

Alistwhosefirstelementistheentitynameofthechosenobjectandwhosesecondelementisthecoordinates(intermsofthecurrentUCS)ofthepointusedtopicktheobject.

Thepickpointreturnedbyentseldoesnotrepresentapointthatliesontheselectedobject.Thepointreturnedisthelocationofthecrosshairsatthetimeofselection.Therelationshipbetweenthepickpointandtheobjectwillvarydependingonthesizeofthepickboxandthecurrentzoomscale.

Examples

ThefollowingAutoCADcommandsequenceillustratestheuseoftheentselfunctionandthelistreturned:

Command: line

Frompoint: 1,1

Topoint: 6,6

Topoint: ENTER

Command: (setqe(entsel"Pleasechooseanobject:"))

Pleasechooseanobject: 3,3

(<Entityname:60000014>(3.03.00.0))

Page 161: less than or equalAutoLISP Functions

Whenoperatingonobjects,youmaywanttosimultaneouslyselectanobjectandspecifythepointbywhichitwasselected.ExamplesofthisinAutoCADcanbefoundinObjectSnapandintheBREAK,TRIM,andEXTENDcommandsintheCommandReference.TheentselfunctionallowsAutoLISPprogramstoperformthisoperation.Itselectsasingleobject,requiringtheselectiontobeapickpoint.ThecurrentOsnapsettingisignoredbythisfunctionunlessyouspecificallyrequestitwhileyouareinthefunction.Theentselfunctionhonorskeywordsfromaprecedingcalltoinitget.

SeeAlsoTheentget,entmake,entnext,handent,andinitgetfunctions.

Pleasesendusyourcommentaboutthispage

Page 162: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

entupd

Updatesthescreenimageofanobject(entity)

(entupdename)

Arguments

ename

Thenameoftheentitytobeupdatedonthescreen.

ReturnValues

Theentity(ename)updated;otherwisenil,ifnothingwasupdated.

Examples

Assumingthatthefirstentityinthedrawingisa3Dpolylinewithseveralvertices,thefollowingcodemodifiesandredisplaysthepolyline:

(setqe1(entnext));Setse1tothepolyline'sentity

name

(setqe2(entnexte1));Setse2toitsfirstvertex

(setqed(entgete2));Setsedtothevertexdata

(setqed

(subst'(101.02.0)

(assoc10ed);Changesthevertex'slocationined

ed;topoint(1,2)

)

)

(entmoded);Moves

thevertexinthedrawing

(entupde1);Regenerates

thepolylineentitye1

UpdatingPolylinesandBlocks

Whena3D(orold-style)polylinevertexorblockattributeismodifiedwith

Page 163: less than or equalAutoLISP Functions

entmod,theentirecomplexentityisnotupdatedonthescreen.Theentupdfunctioncanbeusedtocauseamodifiedpolylineorblocktobeupdatedonthescreen.Thisfunctioncanbecalledwiththeentitynameofanypartofthepolylineorblock;itneednotbetheheadentity.Whileentupdisintendedforpolylinesandblockswithattributes,itcanbecalledforanyentity.Italwaysregeneratestheentityonthescreen,includingallsubentities.

Note Ifentupdisusedonanestedentity(anentitywithinablock)oronablockthatcontainsnestedentities,someoftheentitiesmightnotberegenerated.Toensurecompleteregeneration,youmustinvoketheREGENcommandintheCommandReference.

SeeAlsoTheentget,entmod,entnext,andhandentfunctions.

Pleasesendusyourcommentaboutthispage

Page 164: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

eq

Determineswhethertwoexpressionsareidentical

(eqexpr1expr2)

Theeqfunctiondetermineswhetherexpr1andexpr2areboundtothesameobject(bysetq,forexample).

Arguments

expr1

Theexpressiontobecompared.

expr2

Theexpressiontocomparewithexpr1.

ReturnValues

Tifthetwoexpressionsareidentical;otherwisenil.

Examples

Giventhefollowingassignments:

(setqf1'(abc))

(setqf2'(abc))

(setqf3f2)

Comparef1andf3:Command:(eqf1f3)

nil

eqreturnsnilbecausef1andf3,whilecontainingthesamevalue,donotrefertothesamelist.

Page 165: less than or equalAutoLISP Functions

Comparef3andf2:Command:(eqf3f2)

T

eqreturnsTbecausef3andf2refertothesamelist.

SeeAlsoThe=(equalto)andequalfunctions.

Pleasesendusyourcommentaboutthispage

Page 166: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

equal

Determineswhethertwoexpressionsareequal

(equalexpr1expr2[fuzz])

Arguments

expr1

Theexpressiontobecompared.

expr2

Theexpressiontocomparewithexpr1.

fuzz

Arealnumberdefiningthemaximumamountbywhichexpr1andexpr2candifferandstillbeconsideredequal.

Whencomparingtworealnumbers(ortwolistsofrealnumbers,asinpoints),thetwoidenticalnumberscandifferslightlyifdifferentmethodsareusedtocalculatethem.Youcanspecifyafuzzamounttocompensateforthedifferencethatmayresultfromthedifferentmethodsofcalculation.

ReturnValues

Tifthetwoexpressionsareequal(evaluatetothesamevalue);otherwisenil.

Examples

Giventhefollowingassignments:

(setqf1'(abc))

(setqf2'(abc))

(setqf3f2)

(setqa1.123456)

Page 167: less than or equalAutoLISP Functions

(setqb1.123457)

Comparef1tof3:Command:(equalf1f3)

T

Comparef3tof2:Command:(equalf3f2)

T

Compareatob:Command:(equalab)

nil

Theaandbvariablesdifferby.000001.

Compareatob:,withfuzzargumentof.000001:Command:(equalab0.000001)

T

Theaandbvariablesdifferbyanamountequaltothespecifiedfuzzfactor,soequalconsidersthevariablesequal.

ComparingtheeqandequalFunctions

Iftheeqfunctionfindsthattwolistsoratomsarethesame,theequalfunctionalsofindsthemtobethesame.

Anyatomsthattheequalfunctiondeterminestobethesamearealsofoundequivalentbyeq.However,twoliststhatequaldeterminestobethesamemaybefoundtobedifferentaccordingtotheeqfunction.

SeeAlsoThe=(equalto)andeqfunctions.

Pleasesendusyourcommentaboutthispage

Page 168: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

*error*

Auser-definableerror-handlingfunction

(*error*string)

If*error*isnotnil,itisexecutedasafunctionwheneveranAutoLISPerrorconditionexists.AutoCADpassesoneargumentto*error*,whichisastringcontainingadescriptionoftheerror.

Your*error*functioncanincludecallstothecommandfunctionwithoutarguments(forexample,(command)).ThiswillcancelapreviousAutoCADcommandcalledwiththecommandfunction.

ReturnValues

Thisfunctiondoesnotreturn,exceptwhenusingvl-exit-with-value.

Examples

ThefollowingfunctiondoesthesamethingthattheAutoLISPstandarderrorhandlerdoes.Itprintstheword“error,”followedbyadescription:

(defun*error*(msg)

(princ"error:")

(princmsg)

(princ)

)

SeeAlsoThevl-exit-with-error,vl-exit-with-value,vl-catch-all-apply,vl-catch-all-error-message,andvl-catch-all-error-pfunctions.

Pleasesendusyourcommentaboutthispage

Page 169: less than or equalAutoLISP Functions
Page 170: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

eval

ReturnstheresultofevaluatinganAutoLISPexpression

(evalexpr)

Arguments

expr

Theexpressiontobeevaluated.

ReturnValues

Theresultoftheexpression,afterevaluation.

Examples

First,setsomevariables:Command:(setqa123)

123

Command:(setqb'a)

A

Nowevaluatesomeexpressions:Command:(eval4.0)

4.0

Command:(eval(abs-10))

10

Command:(evala)

123

Command:(evalb)

123

Page 171: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 172: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

exit

Forcesthecurrentapplicationtoquit

(exit)

Ifexitiscalled,itreturnstheerrormessagequit/exitabortandreturnstotheAutoCADCommandprompt.

SeeAlsoThequitfunction.

Pleasesendusyourcommentaboutthispage

Page 173: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

exp

Returnstheconstante(arealnumber)raisedtoaspecifiedpower(thenaturalantilog)

(expnum)

Arguments

num

Arealnumber.

ReturnValues

Areal(num),raisedtoitsnaturalantilogarithm.

ExamplesCommand:(exp1.0)

2.71828

Command:(exp2.2)

9.02501

Command:(exp-0.4)

0.67032

Pleasesendusyourcommentaboutthispage

Page 174: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

expand

AllocatesadditionalmemoryforAutoLISP

(expandn-expand)

Arguments

n-expand

Anintegerindicatingtheamountofadditionalmemorytobeallocated.Memoryisallocatedasfollows:

n-allocfreesymbols

n-allocfreestrings

n-allocfreeusubrs

n-allocfreereals

n-alloc*n-expandconscellswheren-allocisthecurrentsegmentsize.

ReturnValues

Anintegerindicatingthenumberoffreeconsesdividedbyn-alloc.

Examples

Setthesegmentsizeto100:

_$(alloc100)1000

Allocatememoryfortwoadditionalsegments:

Page 175: less than or equalAutoLISP Functions

_$(expand2)82

ThisensuresthatAutoLISPnowhasmemoryavailableforatleast200additionalsymbols,strings,usubrsandrealseach,and8200freeconses.

SeeAlsoTheallocfunction.

Pleasesendusyourcommentaboutthispage

Page 176: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>EFunctions>

expt

Returnsanumberraisedtoaspecifiedpower

(exptnumberpower)

Arguments

number

Anynumber.

power

Thepowertoraisenumberto.

ReturnValues

Ifbothargumentsareintegers,theresultisaninteger;otherwise,theresultisareal.

ExamplesCommand:(expt24)

16

Command:(expt3.02.0)

9.0

Pleasesendusyourcommentaboutthispage

Page 177: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

FFunctions

fill_imageDrawsafilledrectangleinthecurrentlyactivedialogboximagetilefindfileSearchestheAutoCADlibrarypathforthespecifiedfileordirectoryfixReturnstheconversionofarealnumberintothenearestsmallerintegerfloatReturnstheconversionofanumberintoarealnumberforeachEvaluatesexpressionsforallmembersofalistfunctionTellstheVisualLISPcompilertolinkandoptimizeanargumentasifitwereabuilt-infunction

Pleasesendusyourcommentaboutthispage

Page 178: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

fill_image

Drawsafilledrectangleinthecurrentlyactivedialogboximagetile

(fill_imagex1y1widthheightcolor)

Thefirst(upper-left)corneroftherectangleislocatedat(x1,y1)andthesecond(lower-right)cornerislocatedtherelativedistance(width,height)fromthefirstcorner.Theorigin(0,0)istheupper-leftcorneroftheimage.Youcanobtainthecoordinatesofthelower-rightcornerbycallingthedimensionfunctionsdimx_tileanddimy_tile.

Thefill_imagefunctionmustbeusedbetweenstart_imageandend_imagefunctioncalls.

Arguments

x1

Xcoordinateoftheupper-leftcorneroftherectanglelocatedat(x1,y1).Mustbeapositivevalue.

y1

Ycoordinateofupper-leftcorner.Mustbeapositivevalue.

width

Widthofthefillarea(inpixels),relativetox1.

height

Widthofthefillarea(inpixels),relativetoy1.

color

AnAutoCADcolornumber,oroneofthelogicalcolornumbersshowninthefollowingtable:

Page 179: less than or equalAutoLISP Functions

Symbolicnamesforcolorattribute

Colornumber ADImnemonic Description

-2 BGLCOLOR CurrentbackgroundoftheAutoCADdrawingarea

-15 DBGLCOLOR Currentdialogboxbackgroundcolor

-16 DFGLCOLOR Currentdialogboxforegroundcolor(text)

-18 LINELCOLOR Currentdialogboxlinecolor

ReturnValues

Anintegerrepresentingthefillcolor.

Examples

(setqcolor-2);;colorofAutoCADdrawingarea

(fill_image

0

0

(dimx_tile"slide_tile")

(dimy_tile"slide_tile")

color

)

(end_image)

Pleasesendusyourcommentaboutthispage

Page 180: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

findfile

SearchestheAutoCADlibrarypathforthespecifiedfileordirectory

(findfilefilename)

Thefindfilefunctionmakesnoassumptionaboutthefiletypeorextensionoffilename.Iffilenamedoesnotspecifyadrive/directoryprefix,findfilesearchestheAutoCADlibrarypath.Ifadrive/directoryprefixissupplied,findfilelooksonlyinthatdirectory.

Arguments

filename

Nameofthefileordirectorytobesearchedfor.

ReturnValues

Astringcontainingthefullyqualifiedfilename;otherwisenil,ifthespecifiedfileordirectoryisnotfound.

Thefilenamereturnedbyfindfileissuitableforusewiththeopenfunction.

Examples

Ifthecurrentdirectoryis/AutoCAD2005anditcontainsthefileabc.lsp,thefollowingfunctioncallretrievesthepathname:

Command:(findfile"abc.lsp")

"C:\\ProgramFiles\\AutoCAD2005\\abc.lsp"

Ifyouareeditingadrawinginthe/AutoCAD2005/drawingsdirectory,andtheACADenvironmentvariableissetto/AutoCAD2005/support,andthefilexyz.txtexistsonlyinthe/AutoCAD2005/supportdirectory,thenthefollowingcommandretrievesthepathname:

Page 181: less than or equalAutoLISP Functions

Command:(findfile"xyz.txt")

"C:\\ProgramFiles\\AutoCAD2005\\support\\xyz.txt"

Ifthefilenosuchisnotpresentinanyofthedirectoriesonthelibrarysearchpath,findfilereturnsnil:

Command:(findfile"nosuch")

nil

Pleasesendusyourcommentaboutthispage

Page 182: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

fix

Returnstheconversionofarealnumberintothenearestsmallerinteger

(fixnumber)

Thefixfunctiontruncatesnumbertothenearestintegerbydiscardingthefractionalportion.

Arguments

number

Arealnumber.

ReturnValues

Theintegerderivedfromnumber.

Ifnumberislargerthanthelargestpossibleinteger(+2,147,483,647or-2,147,483,648ona32-bitplatform),fixreturnsatruncatedreal(althoughintegerstransferredbetweenAutoLISPandAutoCADarerestrictedto16-bitvalues).

ExamplesCommand:(fix3)

3

Command:(fix3.7)

3

Pleasesendusyourcommentaboutthispage

Page 183: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

float

Returnstheconversionofanumberintoarealnumber

(floatnumber)

Arguments

number

Anynumber.

ReturnValues

Therealnumberderivedfromnumber.

ExamplesCommand:(float3)

3.0

Command:(float3.75)

3.75

Pleasesendusyourcommentaboutthispage

Page 184: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

foreach

Evaluatesexpressionsforallmembersofalist

(foreachnamelist[expr...])

Theforeachfunctionstepsthroughalist,assigningeachelementinthelisttoavariable,andevaluateseachexpressionforeveryelementinthelist.Anynumberofexpressionscanbespecified.

Arguments

name

Variablethateachelementinthelistwillbeassignedto.

list

Listtobesteppedthroughandevaluated.

expr

Expressiontobeevaluatedforeachelementinlist.

ReturnValues

Theresultofthelastexprevaluated.Ifnoexprisspecified,foreachreturnsnil.

Examples

Printeachelementinalist:Command:(foreachn'(abc)(printn))

A

B

CC

Page 185: less than or equalAutoLISP Functions

foreachprintseachelementinthelistandreturnsC,thelastelement.Thiscommandisequivalenttothefollowingsequenceofcommands,exceptthatforeachreturnstheresultofonlythelastexpressionevaluated:

(printa)

(printb)

(printc)

Pleasesendusyourcommentaboutthispage

Page 186: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>FFunctions>

function

TellstheVisualLISPcompilertolinkandoptimizeanargumentasifitwereabuilt-infunction

(functionsymbol|lambda-expr)

Thefunctionfunctionisidenticaltothequotefunction,exceptittellstheVisualLISPcompilertolinkandoptimizetheargumentasifitwereabuilt-infunctionordefun.

CompiledlambdaexpressionsthatarequotedbyfunctionwillcontaindebugginginformationwhenloadedintotheVisualLISPIDE.

Arguments

symbol

Asymbolnamingafunction.

lambda-expr

Anexpressionofthefollowingform:(LAMBDAarguments{S-expression}*)

ReturnValues

Theresultoftheevaluatedexpression.

Examples

TheVisualLISPcompilercannotoptimizethequotedlambdaexpressioninthefollowingcode:

(mapcar

'(lambda(x)(*xx))

'(123))

Page 187: less than or equalAutoLISP Functions

Afteraddingthefunctionfunctiontotheexpression,thecompilercanoptimizethelambdaexpression.Forexample:

(mapcar

(function(lambda(x)(*xx)))

'(123))

Pleasesendusyourcommentaboutthispage

Page 188: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

GFunctions

gcForcesagarbagecollection,whichfreesupunusedmemorygcdReturnsthegreatestcommondenominatoroftwointegersget_attrRetrievestheDCLvalueofadialogboxattributeget_tileRetrievesthecurrentruntimevalueofadialogboxtilegetanglePausesforuserinputofanangle,andreturnsthatangleinradiansgetcfgRetrievesapplicationdatafromtheAppDatasectionoftheacad*.cfgfilegetcnameRetrievesthelocalizedorEnglishnameofanAutoCADcommandgetcornerPausesforuserinputofarectangle'ssecondcornergetdistPausesforuserinputofadistancegetenvReturnsthestringvalueassignedtoasystemenvironmentvariablegetfiledPromptstheuserforafilenamewiththestandardAutoCADfiledialogbox,andreturnsthatfilename

Page 189: less than or equalAutoLISP Functions

getintPausesforuserinputofaninteger,andreturnsthatintegergetkwordPausesforuserinputofakeyword,andreturnsthatkeywordgetorientPausesforuserinputofanangle,andreturnsthatangleinradiansgetpointPausesforuserinputofapoint,andreturnsthatpointgetrealPausesforuserinputofarealnumber,andreturnsthatrealnumbergetstringPausesforuserinputofastring,andreturnsthatstringgetvarRetrievesthevalueofanAutoCADsystemvariablegraphscrDisplaystheAutoCADgraphicsscreengrclearClearsthecurrentviewport(obsoletefunction)grdrawDrawsavectorbetweentwopoints,inthecurrentviewportgrreadReadsvaluesfromanyoftheAutoCADinputdevicesgrtextWritestexttothestatuslineortoscreenmenuareasgrvecsDrawsmultiplevectorsinthedrawingarea

Pleasesendusyourcommentaboutthispage

Page 190: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

gc

Forcesagarbagecollection,whichfreesupunusedmemory

(gc)

SeeAlsoTheMemoryManagementFunctionstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 191: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

gcd

Returnsthegreatestcommondenominatoroftwointegers

(gcdint1int2)

Arguments

int1

Aninteger;mustbegreaterthan0.

int2

Aninteger;mustbegreaterthan0.

ReturnValues

Anintegerrepresentingthegreatestcommondenominatorbetweenint1andint2.

ExamplesCommand:(gcd8157)

3

Command:(gcd1220)

4

Pleasesendusyourcommentaboutthispage

Page 192: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

get_attr

RetrievestheDCLvalueofadialogboxattribute

(get_attrkeyattribute)

Arguments

key

Astringthatspecifiesthetile.Thisparameteriscase-sensitive.

attribute

Astringnamingtheattributeasitappearsinthetile'sDCLdescription.

ReturnValues

Astringcontainingtheattribute'sinitialvalueasspecifiedinitsDCLdescription.

Pleasesendusyourcommentaboutthispage

Page 193: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

get_tile

Retrievesthecurrentruntimevalueofadialogboxtile

(get_tilekey)

Arguments

key

Astringthatspecifiesthetile.Thisparameteriscase-sensitive.

ReturnValues

Astringcontainingthetile'svalue.

Pleasesendusyourcommentaboutthispage

Page 194: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getangle

Pausesforuserinputofanangle,andreturnsthatangleinradians

(getangle[pt][msg])

Arguments

pt

A2DbasepointinthecurrentUCS.Theptargument,ifspecified,isassumedtobethefirstoftwopoints,sotheusercanshowAutoLISPtheanglebypointingtooneotherpoint.Youcansupplya3Dbasepoint,buttheangleisalwaysmeasuredinthecurrentconstructionplane.

msg

Astringtobedisplayedtoprompttheuser.

ReturnValues

Theanglespecifiedbytheuser,inradians.

Thegetanglefunctionmeasuresangleswiththezero-radiandirection(setbytheANGBASEsystemvariableintheCommandReference)withanglesincreasinginthecounterclockwisedirection.Thereturnedangleisexpressedinradianswithrespecttothecurrentconstructionplane(theXYplaneofthecurrentUCS,atthecurrentelevation).

Examples

Thefollowingcodeexamplesshowhowdifferentargumentscanbeusedwithgetangle:

Command:(setqang(getangle))

Command:(setqang(getangle'(1.03.5)))

Page 195: less than or equalAutoLISP Functions

Command:(setqang(getangle"Whichway?"))

Command:(setqang(getangle'(1.03.5)"Whichway?"))

UsageNotes

UserscanspecifyananglebyenteringanumberintheAutoCADcurrentangleunitsformat.Althoughthecurrentangleunitsformatmightbeindegrees,grads,orsomeotherunit,thisfunctionalwaysreturnstheangleinradians.TheusercanalsoshowAutoLISPtheanglebypointingtotwo2Dlocationsinthedrawingarea.AutoCADdrawsarubber-bandlinefromthefirstpointtothecurrentcrosshairspositiontohelpyouvisualizetheangle.

Itisimportanttounderstandthedifferencebetweentheinputangleandtheanglereturnedbygetangle.AnglesthatarepassedtogetanglearebasedonthecurrentsettingsofANGDIRandANGBASEintheCommandReference.However,onceanangleisprovided,itismeasuredinacounterclockwisedirection(ignoringANGDIR)withzeroradiansasthecurrentsettingofANGBASE.

TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetanglerequest.

SeeAlsoTheillustrationandcomparisontothegetorientfunction,theinitgetfunction,andThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 196: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getcfg

RetrievesapplicationdatafromtheAppDatasectionoftheacad*.cfgfile

(getcfgcfgname)

Arguments

cfgname

Astring(maximumlengthof496characters)namingthesectionandparametervaluetoretrieve.

Thecfgnameargumentmustbeastringofthefollowingform:

"AppData/application_name/section_name/.../param_name"

ReturnValues

Applicationdata,ifsuccessful.Ifcfgnameisnotvalid,getcfgreturnsnil.

Examples

AssumingtheWallThkparameterintheAppData/ArchStuffsectionhasavalueof8,thefollowingcommandretrievesthatvalue:

Command:(getcfg"AppData/ArchStuff/WallThk")

"8"

SeeAlsoThesetcfgfunction.

Pleasesendusyourcommentaboutthispage

Page 197: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getcname

RetrievesthelocalizedorEnglishnameofanAutoCADcommand

(getcnamecname)

Arguments

cname

ThelocalizedorunderscoredEnglishcommandname;mustbe64charactersorlessinlength.

ReturnValues

Ifcnameisnotprecededbyanunderscore(assumedtobethelocalizedcommandname),getcnamereturnstheunderscoredEnglishcommandname.Ifcnameisprecededbyanunderscore,getcnamereturnsthelocalizedcommandname.Thisfunctionreturnsnilifcnameisnotavalidcommandname.

Examples

InaFrenchversionofAutoCAD,thefollowingistrue.

(getcname"ETIRER")returns"_STRETCH"

(getcname"_STRETCH")returns"ETIRER"

Pleasesendusyourcommentaboutthispage

Page 198: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getcorner

Pausesforuserinputofarectangle'ssecondcorner

(getcornerpt[msg])

Thegetcornerfunctiontakesabasepointargument,basedonthecurrentUCS,anddrawsarectanglefromthatpointastheusermovesthecrosshairsonthescreen.

TheusercannotenteranotherAutoLISPexpressioninresponsetoagetcornerrequest.

Arguments

pt

Apointtobeusedasthebasepoint.

msg

Astringtobedisplayedtoprompttheuser.

ReturnValues

ThegetcornerfunctionreturnsapointinthecurrentUCS,similartogetpoint.Iftheusersuppliesa3Dpoint,itsZcoordinateisignored.ThecurrentelevationisusedastheZcoordinate.

ExamplesCommand:(getcorner'(7.649356.029640.0))

(17.20661.476280.0)

Command:(getcorner'(7.649356.029640.0)"Pickacorner")

Pickacorner(15.95842.401190.0)

SeeAlso

Page 199: less than or equalAutoLISP Functions

Theinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 200: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getdist

Pausesforuserinputofadistance

(getdist[pt][msg])

Theusercanspecifythedistancebyselectingtwopoints,orbyspecifyingjustthesecondpoint,ifabasepointisprovided.TheusercanalsospecifyadistancebyenteringanumberintheAutoCADcurrentdistanceunitsformat.Althoughthecurrentdistanceunitsformatmightbeinfeetandinches(architectural),thegetdistfunctionalwaysreturnsthedistanceasareal.

Thegetdistfunctiondrawsarubber-bandlinefromthefirstpointtothecurrentcrosshairspositiontohelptheuservisualizethedistance.

TheusercannotenteranotherAutoLISPexpressioninresponsetoagetdistrequest.

Arguments

pt

A2Dor3DpointtobeusedasthebasepointinthecurrentUCS.Ifptisprovided,theuserispromptedforthesecondpoint.

msg

Astringtobedisplayedtoprompttheuser.Ifnostringissupplied,AutoCADdoesnotdisplayamessage.

ReturnValues

Arealnumber.Ifa3Dpointisprovided,thereturnedvalueisa3Ddistance.However,settingthe64bitoftheinitgetfunctioninstructsgetdisttoignoretheZcomponentof3Dpointsandtoreturna2Ddistance.

Examples

Page 201: less than or equalAutoLISP Functions

(setqdist(getdist))

(setqdist(getdist'(1.03.5)))

(setqdist(getdist"Howfar"))

(setqdist(getdist'(1.03.5)"Howfar?"))

SeeAlsoTheinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 202: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getenv

Returnsthestringvalueassignedtoasystemenvironmentvariable

(getenvvariable-name)

Arguments

variable-name

Astringspecifyingthenameofthevariabletoberead.Environmentvariablenamesmustbespelledandcasedexactlyastheyarestoredinthesystemregistry.

ReturnValues

Astringrepresentingthevalueassignedtothespecifiedsystemvariable.Ifthevariabledoesnotexist,getenvreturnsnil.

Examples

AssumethesystemenvironmentvariableACADissetto/acad/supportandthereisnovariablenamedNOSUCH.

Command:(getenv"ACAD")

"/acad/support"

Command:(getenv"NOSUCH")

nil

AssumethattheMaxArrayenvironmentvariableissetto10000:Command:(getenv"MaxArray")

"10000"

SeeAlsoThesetenvfunction.

Page 203: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 204: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getfiled

PromptstheuserforafilenamewiththestandardAutoCADfiledialogbox,andreturnsthatfilename

(getfiledtitledefaultextflags)

Thegetfiledfunctiondisplaysadialogboxcontainingalistofavailablefilesofaspecifiedextensiontype.Youcanusethisdialogboxtobrowsethroughdifferentdrivesanddirectories,selectanexistingfile,orspecifythenameofanewfile.

Arguments

title

Astringspecifyingthedialogboxlabel.

default

Adefaultfilenametouse;canbeanullstring("").

ext

Thedefaultfilenameextension.Ifextispassedasanullstring(""),itdefaultsto*(allfiletypes).Ifthefiletypedwgisincludedintheextargument,thegetfiledfunctiondisplaysanimagepreviewinthedialogbox.

flags

Anintegervalue(abit-codedfield)thatcontrolsthebehaviorofthedialogbox.Tosetmorethanoneconditionatatime,addthevaluestogethertocreateaflagsvaluebetween0and15.Thefollowingflagsargumentsarerecognizedbygetfiled:1(bit0) Promptforthenameofanewfiletocreate.Donotsetthisbit

Page 205: less than or equalAutoLISP Functions

whenyoupromptforthenameofanexistingfiletoopen.Inthelattercase,iftheuserentersthenameofafilethatdoesn'texist,thedialogboxdisplaysanerrormessageatthebottomofthebox.Ifthisbitissetandtheuserchoosesafilethatalreadyexists,AutoCADdisplaysanalertboxandoffersthechoiceofproceedingwithorcancelingtheoperation.4(bit2) Lettheuserenteranarbitraryfilenameextension,ornoextensionatall.Ifthisbitisnotset,getfiledacceptsonlytheextensionspecifiedintheextargumentandappendsthisextensiontothefilenameiftheuserdoesn'tenteritintheFiletextbox.8(bit3) Ifthisbitissetandbit0isnotset,getfiledperformsalibrarysearchforthefilenameentered.Ifitfindsthefileanditsdirectoryinthelibrarysearchpath,itstripsthepathandreturnsonlythefilename.(Itdoesnotstripthepathnameifitfindsthatafileofthesamenameisinadifferentdirectory.)Ifthisbitisnotset,getfiledreturnstheentirefilename,includingthepathname.Setthisbitifyouusethedialogboxtoopenanexistingfilewhosenameyouwanttosaveinthedrawing(orotherdatabase).16(bit4) Ifthisbitisset,orifthedefaultargumentendswithapathdelimiter,theargumentisinterpretedasapathnameonly.Thegetfiledfunctionassumesthatthereisnodefaultfilename.ItdisplaysthepathintheLookin:lineandleavestheFilenameboxblank.32(bit5) Ifthisbitissetandbit0isset(indicatingthatanewfileisbeingspecified),userswillnotbewarnediftheyareabouttooverwriteanexistingfile.Thealertboxtowarnusersthatafileofthesamenamealreadyexistswillnotbedisplayed;theoldfilewilljustbereplaced.64(bit6) DonottransfertheremotefileiftheuserspecifiesaURL.128(bit7) DonotallowURLsatall.

ReturnValues

Ifthedialogboxobtainsafilenamefromtheuser,getfiledreturnsastringthatspecifiesthefilename;otherwise,itreturnsnil.

Examples

Page 206: less than or equalAutoLISP Functions

ThefollowingcalltogetfileddisplaystheSelectaLispFiledialogbox:

(getfiled"SelectaLispFile""c:/programfiles/<AutoCADinstallationdirectory>/support/""lsp"8)

AutoCADdisplaysthefollowingdialogboxasaresult:

Pleasesendusyourcommentaboutthispage

Page 207: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getint

Pausesforuserinputofaninteger,andreturnsthatinteger

(getint[msg])

Valuespassedtogetintcanrangefrom-32,768to+32,767.Iftheuserenterssomethingotherthananinteger,getintdisplaysthemessage,“Requiresanintegervalue,”andallowstheusertotryagain.TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetintrequest.

Arguments

msg

Astringtobedisplayedtoprompttheuser;ifomitted,nomessageisdisplayed.

ReturnValues

Theintegerspecifiedbytheuser;otherwisenil,iftheuserpressesENTERwithoutenteringaninteger.

ExamplesCommand:(setqnum(getint))

15

15

Command:(setqnum(getint"Enteranumber:"))

Enteranumber:25

25

Command:(setqnum(getint))

15.0

Requiresanintegervalue.

15

Page 208: less than or equalAutoLISP Functions

15

SeeAlsoTheinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 209: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getkword

Pausesforuserinputofakeyword,andreturnsthatkeyword

(getkword[msg])

Validkeywordsaresetpriortothegetkwordcallwiththeinitgetfunction.TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetkwordrequest.

Arguments

msg

Astringtobedisplayedtoprompttheuser;ifomitted,getkworddoesnotdisplayapromptingmessage.

ReturnValues

Astringrepresentingthekeywordenteredbytheuser;otherwisenil,iftheuserpressesENTERwithouttypingakeyword.Thefunctionalsoreturnsnilifitwasnotprecededbyacalltoinitgettoestablishoneormorekeywords.

Iftheuserentersavaluethatisnotavalidkeyword,getkworddisplaysawarningmessageandpromptstheusertotryagain.

Examples

Thefollowingexampleshowsaninitialcalltoinitgetthatsetsupalistofkeywords(YesandNo)anddisallowsnullinput(bitsvalueequalto1)tothegetkwordcallthatfollows:

Command:(initget1"YesNo")

nil

Command:(setqx(getkword"Areyousure?(YesorNo)"))

Areyousure?(YesorNo)yes

Page 210: less than or equalAutoLISP Functions

"Yes"

Thefollowingsequenceillustrateswhathappensiftheuserentersinvaliddatainresponsetogetkword:

Command:(initget1"YesNo")

nil

Command:(setqx(getkword"Areyousure?(YesorNo)"))

Areyousure?(YesorNo)Maybe

Invalidoptionkeyword.

Areyousure?(YesorNo)yes

"Yes"

Theuser'sresponsewasnotoneofthekeywordsdefinedbytheprecedinginitget,sogetkwordissuedanerrormessageandthenpromptedtheuseragainwiththestringsuppliedinthemsgargument.

SeeAlsoTheinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 211: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getorient

Pausesforuserinputofanangle,andreturnsthatangleinradians

(getorient[pt][msg])

Thegetorientfunctionmeasuresangleswiththezero-radiandirectiontotheright(east)andanglesthatareincreasinginthecounterclockwisedirection.TheangleinputbytheuserisbasedonthecurrentsettingsofANGDIRandANGBASE,butonceanangleisprovided,itismeasuredinacounterclockwisedirection,withzeroradiansbeingtotheright(ignoringANGDIRandANGBASE).Therefore,someconversionmusttakeplaceifyouselectadifferentzero-degreebaseoradifferentdirectionforincreasinganglesbyusingtheUNITScommandortheANGBASEandANGDIRsystemvariablesintheCommandReference.

Usegetanglewhenyouneedarotationamount(arelativeangle).Usegetorienttoobtainanorientation(anabsoluteangle).

TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetorientrequest.

Arguments

pt

A2DbasepointinthecurrentUCS.Theptargument,ifspecified,isassumedtobethefirstoftwopoints,sothattheusercanshowAutoLISPtheanglebypointingtooneotherpoint.Youcansupplya3Dbasepoint,buttheangleisalwaysmeasuredinthecurrentconstructionplane.

msg

Astringtobedisplayedtoprompttheuser.

Page 212: less than or equalAutoLISP Functions

ReturnValues

Theanglespecifiedbytheuser,inradians,withrespecttothecurrentconstructionplane.

ExamplesCommand:(setqpt1(getpoint"Pickpoint:"))

(4.550285.847220.0)

Command:(getorientpt1"Pickpoint:")

5.61582

SeeAlsoThegetangleandinitgetfunctions.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 213: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getpoint

Pausesforuserinputofapoint,andreturnsthatpoint

(getpoint[pt][msg])

Theusercanspecifyapointbypointingorbyenteringacoordinateinthecurrentunitsformat.Iftheptargumentispresent,AutoCADdrawsarubber-bandlinefromthatpointtothecurrentcrosshairsposition.

TheusercannotenteranotherAutoLISPexpressioninresponsetoagetpointrequest.

Arguments

pt

A2Dor3DbasepointinthecurrentUCS.Notethatgetpointwillacceptasingleintegerorrealnumberastheptargument,andusetheAutoCADdirectdistanceentrymechanismtodetermineapoint.ThismechanismusesthevalueoftheLASTPOINTsystemvariableintheCommandReferenceasthestartingpoint,theptinputasthedistance,andthecurrentcursorlocationasthedirectionfromLASTPOINT.TheresultisapointthatisthespecifiednumberofunitsawayfromLASTPOINTinthedirectionofthecurrentcursorlocation.

msg

Astringtobedisplayedtoprompttheuser.

ReturnValues

A3Dpoint,expressedintermsofthecurrentUCS.

Examples

Page 214: less than or equalAutoLISP Functions

(setqp(getpoint))

(setqp(getpoint"Where?"))

(setqp(getpoint'(1.52.0)"Secondpoint:"))

SeeAlsoThegetcornerandinitgetfunctions.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 215: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getreal

Pausesforuserinputofarealnumber,andreturnsthatrealnumber

(getreal[msg])

TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetrealrequest.

Arguments

msg

Astringtobedisplayedtoprompttheuser.

ReturnValues

Therealnumberenteredbytheuser.

Examples

(setqval(getreal))

(setqval(getreal"Scalefactor:"))

SeeAlsoTheinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 216: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getstring

Pausesforuserinputofastring,andreturnsthatstring

(getstring[cr][msg])

TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetstringrequest.

Arguments

cr

Ifsuppliedandnotnil,thisargumentindicatesthatuserscanincludeblanksintheirinputstring(andmustterminatethestringbypressingENTER).Otherwise,theinputstringisterminatedbyenteringaspaceorpressingENTER.

msg

Astringtobedisplayedtoprompttheuser.

ReturnValues

Thestringenteredbytheuser;otherwisenil,iftheuserpressedENTERwithouttypingastring.

Ifthestringislongerthan132characters,getstringreturnsonlythefirst132charactersofthestring.Iftheinputstringcontainsthebackslashcharacter(\),getstringconvertsittotwobackslashcharacters(\\).Thisallowsyoutousereturnedvaluescontainingfilenamepathsinotherfunctions.

ExamplesCommand:(setqs(getstring"What'syourfirstname?"))

What'syourfirstname?Gary

"Gary"

Page 217: less than or equalAutoLISP Functions

Command:(setqs(getstringT"What'syourfullname?"))

What'syourfullname?GaryIndianaJones

"GaryIndianaJones"

Command:(setqs(getstringT"Enterfilename:"))

Enterfilename:c:\mydocuments\vlisp\secrets

"c:\\mydocuments\\vlisp\\secrets"

SeeAlsoTheinitgetfunction.ThegetxxxFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 218: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

getvar

RetrievesthevalueofanAutoCADsystemvariable

(getvarvarname)

Arguments

varname

Astringorsymbolthatnamesasystemvariable.SeetheCommandReferenceforalistofcurrentAutoCADsystemvariables.

ReturnValues

Thevalueofthesystemvariable;otherwisenil,ifvarnameisnotavalidsystemvariable.

Examples

Getthecurrentvalueofthefilletradius:Command:(getvar'FILLETRAD)

0.25

SeeAlsoThesetvarfunction.

Pleasesendusyourcommentaboutthispage

Page 219: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

graphscr

DisplaystheAutoCADgraphicsscreen

(graphscr)

ThisfunctionisequivalenttotheGRAPHSCRcommandintheCommandReferenceorpressingtheFlipScreenfunctionkey.Thetextscrfunctionisthecomplementofgraphscr.

Returns

nil

SeeAlsoThetextscrfunction.

Pleasesendusyourcommentaboutthispage

Page 220: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

grclear

Clearsthecurrentviewport(obsoletefunction)

(grclear)

Returns

nil

Pleasesendusyourcommentaboutthispage

Page 221: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

grdraw

Drawsavectorbetweentwopoints,inthecurrentviewport

(grdrawfromtocolor[highlight])

Arguments

from

2Dor3Dpoints(listsoftwoorthreereals)specifyingoneendpointofthevectorintermsofthecurrentUCS.AutoCADclipsthevectortofitthescreen.

to

2Dor3Dpoints(listsoftwoorthreereals)specifyingtheotherendpointofthevectorintermsofthecurrentUCS.AutoCADclipsthevectortofitthescreen.

color

Anintegeridentifyingthecolorusedtodrawthevector.A-1signifiesXORink,whichcomplementsanythingitdrawsoverandwhicherasesitselfwhenoverdrawn.

highlight

Aninteger,otherthanzero,indicatingthatthevectoristobedrawnusingthedefaulthighlightingmethodofthedisplaydevice(usuallydashed).Ifhighlightisomittedoriszero,grdrawusesthenormaldisplaymode.

ReturnValues

nil

SeeAlso

Page 222: less than or equalAutoLISP Functions

Thegrvecsfunctionforaroutinethatdrawsmultiplevectors.

Pleasesendusyourcommentaboutthispage

Page 223: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

grread

ReadsvaluesfromanyoftheAutoCADinputdevices

(grread[track][allkeys[curtype]])

OnlyspecializedAutoLISProutinesneedthisfunction.MostinputtoAutoLISPshouldbeobtainedthroughthevariousgetxxxfunctions.

Arguments

track

Ifsuppliedandnotnil,thisargumentenablesthereturnofcoordinatesfromapointingdeviceasitismoved.

allkeys

Anintegerrepresentingacodethattellsgrreadwhatfunctionstoperform.Theallkeysbitcodevaluescanbeaddedtogetherforcombinedfunctionality.Thefollowingvaluescanbespecified:1(bit0) Returndragmodecoordinates.Ifthisbitissetandtheusermovesthepointingdeviceinsteadofselectingabuttonorpressingakey,grreadreturnsalistwherethefirstmemberisatype5andthesecondmemberisthe(X,Y)coordinatesofthecurrentpointingdevice(mouseordigitizer)location.ThisishowAutoCADimplementsdragging.2(bit1) Returnallkeyvalues,includingfunctionandcursorkeycodes,anddon'tmovethecursorwhentheuserpressesacursorkey.4(bit2) Usethevaluepassedinthecurtypeargumenttocontrolthecursordisplay.8(bit3) Don'tdisplaytheerror:consolebreakmessagewhentheuserpressesESC.

curtype

Page 224: less than or equalAutoLISP Functions

Anintegerindicatingthetypeofcursortobedisplayed.Theallkeysvalueforbit2mustbesetforthecurtypevaluestotakeeffect.Thecurtypeargumentaffectsonlythecursortypeduringthecurrentgrreadfunctioncall.Youcanspecifyoneofthefollowingvaluesforcurtype:0 Displaythenormalcrosshairs.1 Donotdisplayacursor(nocrosshairs).2 Displaytheobject-selection“target”cursor.

ReturnValues

Thegrreadfunctionreturnsalistwhosefirstelementisacodespecifyingthetypeofinput.Thesecondelementofthelistiseitheranintegerorapoint,dependingonthetypeofinput.Thereturnvaluesarelistedinthefollowingtable:

grreadreturnvalues

Firstelement Secondelement

Value Typeofinput Value Description

2 Keyboardinput

varies Charactercode

3 Selectedpoint

3Dpoint Pointcoordinates

4 Screen/pull-downmenuitem(frompointingdevice)

0to9991001to19992001to29993001to3999

Screenmenuboxno.POP1menuboxno.POP2menuboxno.POP3menuboxno....andsoon,toPOP16menuboxno.

Page 225: less than or equalAutoLISP Functions

…andsoon,to16001to16999

5 Pointingdevice(returnedonlyiftrackingisenabled)

3Dpoint Dragmodecoordinate

6 BUTTONSmenuitem

0to9991000to19992000to29993000to3999

BUTTONS1menubuttonno.BUTTONS2menubuttonno.BUTTONS3menubuttonno.BUTTONS4menubuttonno.

7 TABLET1menuitem

0to32767 Digitizedboxno.

8 TABLET2menuitem

0to32767 Digitizedboxno.

9 TABLET3menuitem

0to32767 Digitizedboxno.

10 TABLET4menuitem

0to32767 Digitizedboxno.

11 AUXmenuitem

0to9991000to1999

AUX1menubuttonno.AUX2menubuttonno.

Page 226: less than or equalAutoLISP Functions

2000to29993000to3999

AUX3menubuttonno.AUX4menubuttonno.

12 Pointerbutton(followsatype6ortype11return)

3Dpoint Pointcoordinates

HandlingUserInputwithgrread

EnteringESCwhileagrreadisactiveabortstheAutoLISPprogramwithakeyboardbreak(unlesstheallkeysargumenthasdisallowedthis).Anyotherinputispasseddirectlytogrread,givingtheapplicationcompletecontrolovertheinputdevices.

Iftheuserpressesthepointerbuttonwithinascreenmenuorpull-downmenubox,grreadreturnsatype6ortype11code,butinasubsequentcall,itdoesnotreturnatype12code:thetype12codefollowstype6ortype11onlywhenthepointerbuttonispressedwhileitisinthedrawingarea.

Itisimportanttoclearthecode12datafromthebufferbeforeattemptinganotheroperationwithapointerbuttonoranauxiliarybutton.Toaccomplishthis,performanestedgrreadlikethis:

(setqcode_12(grread(setqcode(grread))))

Thissequencecapturesthevalueofthecode12listasstreaminginputfromthedevice.

Pleasesendusyourcommentaboutthispage

Page 227: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

grtext

Writestexttothestatuslineortoscreenmenuareas

(grtext[boxtext[highlight]])

Thisfunctiondisplaysthesuppliedtextinthemenuarea;itdoesnotchangetheunderlyingmenuitem.Thegrtextfunctioncanbecalledwithnoargumentstorestorealltextareastotheirstandardvalues.

Arguments

box

Anintegerspecifyingthelocationinwhichtowritethetext.

text

Astringthatspecifiesthetexttobewrittentothescreenmenuorstatuslinelocation.Thetextargumentistruncatedifitistoolongtofitintheavailablearea.

highlight

Anintegerthatselectsordeselectsascreenmenulocation.

Ifcalledwithoutarguments,grtextrestoresalltextareastotheirstandardvalues.Ifcalledwithonlyoneargument,grtextresultsinanerror.

ReturnValues

Thestringpassedinthetextargument,ifsuccessful,andnilifunsuccessfulornoargumentsaresupplied.

ScreenMenuArea

Settingboxtoapositiveorzerovaluespecifiesascreenmenulocation.Validboxvaluesrangefrom0tothehighest-numberedscreenmenuboxminus1.The

Page 228: less than or equalAutoLISP Functions

SCREENBOXESsystemvariableintheCommandReferencereportsthemaximumnumberofscreenmenuboxes.Ifthehighlightargumentissuppliedasapositiveinteger,grtexthighlightsthetextinthedesignatedbox.Highlightingaboxautomaticallydehighlightsanyotherboxalreadyhighlighted.Ifhighlightiszero,themenuitemisdehighlighted.Ifhighlightisanegativenumber,itisignored.Onsomeplatforms,thetextmustfirstbewrittenwithoutthehighlightargumentandthenmustbehighlighted.Highlightingofascreenmenulocationworksonlywhenthecursorisnotinthatarea.

StatusLineArea

Ifgrtextiscalledwithaboxvalueof-1,itwritesthetextintothemodestatuslinearea.Thelengthofthemodestatuslinediffersfromdisplaytodisplay(mostallowatleast40characters).Thefollowingcodeusesthe$(linelen)DIESELexpressiontoreportthelengthofthemodestatusarea.

(setqmodelen(menucmd"M=$(linelen)"))

Ifaboxvalueof-2isused,grtextwritesthetextintothecoordinatestatuslinearea.Ifcoordinatetrackingisturnedon,valueswrittenintothisfieldareoverwrittenassoonasthepointersendsanothersetofcoordinates.Forboth-1and-2boxvalues,thehighlightargumentisignored.

Pleasesendusyourcommentaboutthispage

Page 229: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>GFunctions>

grvecs

Drawsmultiplevectorsinthedrawingarea

(grvecsvlist[trans])

Arguments

vlist

Avectorlistiscomprosedofaseriesofoptionalcolorintegersandtwopointlists.Seebelowfordetailsonhowtoformatvlist.

trans

Atransformationmatrixusedtochangethelocationorproportionofthevectorsdefinedinyourvectorlist.Thismatrixisalistoffourlistsoffourrealnumbers.

ReturnValues

nil

VectorListFormat

Theformatforvlistisasfollows:

([color1]from1to1[color2]from2to2...)

Thecolorvalueappliestoallsucceedingvectorsuntilvlistspecifiesanothercolor.AutoCADcolorsareintherange0-255.Ifthecolorvalueisgreaterthan255,succeedingvectorsaredrawninXORink,whichcomplementsanythingitdrawsoverandwhicherasesitselfwhenoverdrawn.Ifthecolorvalueislessthanzero,thevectorishighlighted.Highlightingdependsonthedisplaydevice.Mostdisplaydevicesindicatehighlightingbyadashedline,butsomeindicateitbyusingadistinctivecolor.

Page 230: less than or equalAutoLISP Functions

Apairofpointlists,fromandto,specifytheendpointsofthevectors,expressedinthecurrentUCS.Thesecanbe2Dor3Dpoints.Youmustpassthesepointsaspairs—twosuccessivepointlists—orthegrvecscallwillfail.

AutoCADclipsthevectorsasrequiredtofitonthescreen.

Examples

Thefollowingcodedrawsfiveverticallinesinthedrawingarea,eachadifferentcolor:

(grvecs'(1(12)(15)Draws

aredlinefrom(1,2)to(1,5)

2(22)(25)Drawsayellowlinefrom(2,2)to(2,5)

3(32)(35)Drawsagreenlinefrom(3,2)to(3,5)

4(42)(45)Drawsacyanlinefrom(4,2)to(4,5)

5(52)(55)Drawsabluelinefrom(5,2)to(5,5)

))

Thefollowingmatrixrepresentsauniformscaleof1.0andatranslationof5.0,5.0,0.0.Ifthismatrixisappliedtotheprecedinglistofvectors,theywillbeoffsetby5.0,5.0,0.0.

'((1.00.00.05.0)

(0.01.00.05.0)

(0.00.01.00.0)

(0.00.00.01.0)

)

SeeAlsoThenentselpfunctionformoreinformationontransformationmatrixesandthegrdrawfunctionforaroutinethatdrawsavectorbetweentwopoints.

Pleasesendusyourcommentaboutthispage

Page 231: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

HFunctions

handentReturnsanobject(entity)namebasedonitshandlehelpInvokestheHelpfacility

Pleasesendusyourcommentaboutthispage

Page 232: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>HFunctions>

handent

Returnsanobject(entity)namebasedonitshandle

(handenthandle)

Thehandentfunctionreturnstheentitynameofbothgraphicandnongraphicentities.

Arguments

handle

Astringidentifyinganentityhandle.

ReturnValues

Ifsuccessful,handentreturnstheentitynameassociatedwithhandleinthecurrenteditingsession.Ifhandentispassedaninvalidhandleorahandlenotusedbyanyentityinthecurrentdrawing,itreturnsnil.

Thehandentfunctionreturnsentitiesthathavebeendeletedduringthecurrenteditingsession.Youcanundeletethemwiththeentdelfunction.

Anentity'snamecanchangefromoneeditingsessiontothenext,butanentity'shandleremainsconstant.

ExamplesCommand:(handent"5A2")

<Entityname:60004722>

Usedwiththesamedrawingbutinanothereditingsession,thesamecallmightreturnadifferententityname.Oncetheentitynameisobtained,youcanuseittomanipulatetheentitywithanyoftheentity-relatedfunctions.

SeeAlso

Page 233: less than or equalAutoLISP Functions

Theentdel,entget,entlast,entmake,entmakex,entmod,entnext,entsel,andentupdfunctions.

Pleasesendusyourcommentaboutthispage

Page 234: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>HFunctions>

help

InvokestheHelpfacility

(help[helpfile[topic[command]]])

Arguments

helpfile

AstringnamingtheHelpfile.Thefileextensionisnotrequiredwiththehelpfileargument.Ifafileextensionisprovided,AutoCADlooksonlyforafilewiththeexactnamespecified.Ifnofileextensionisprovided,AutoCADlooksforhelpfilewithanextensionof.chm.Ifnofileofthatnameisfound,AutoCADlooksforafilewithanextensionof.hlp.

topic

AstringidentifyingaHelptopicID.IfyouarecallingatopicwithinaCHMfile,providethefilenamewithouttheextension;AutoCADaddsan.htmextension.

command

AstringthatspecifiestheinitialstateoftheHelpwindow.ThecommandargumentisastringusedbytheuCommand(inHTMLHelp)orthefuCommand(inWinHelp)argumentoftheHtmlHelp()andWinHelp()functionsasdefinedintheMicrosoftWindowsSDK.ForHTMLHelpfiles,thecommandparametercanbeHH_ALINK_LOOKUPorHH_DISPLAY_TOPIC.ForWindowsHelpfiles,thecommandparametercanbeHELP_CONTENTS,HELP_HELPONHELP,orHELP_PARTIALKEY.

ReturnValues

Page 235: less than or equalAutoLISP Functions

Thehelpfilestring,ifsuccessful;otherwisenil.Ifyouusehelpwithoutanyarguments,itreturnsanemptystring("")ifsuccessful,andnilifitfails.

Theonlyerrorconditionthatthehelpfunctionreturnstotheapplicationistheexistenceofthefilespecifiedbyhelpfile.Allothererrorconditionsarereportedtotheuserthroughadialogbox.

Examples

ThefollowingcodecallshelptodisplaytheinformationonMYCOMMANDintheHelpfileachelp.chm:

(help"achelp.chm""mycommand")

SeeAlsoThesetfunhelpfunctionassociatescontext-sensitiveHelp(whentheuserpressesF1)withauser-definedcommand.

Pleasesendusyourcommentaboutthispage

Page 236: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

IFunctions

ifConditionallyevaluatesexpressionsinitdiaForcesthedisplayofthenextcommand'sdialogboxinitgetEstablisheskeywordsforusebythenextuser-inputfunctioncallintersFindstheintersectionoftwolinesitoaReturnstheconversionofanintegerintoastring

Pleasesendusyourcommentaboutthispage

Page 237: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>IFunctions>

if

Conditionallyevaluatesexpressions

(iftestexprthenexpr[elseexpr])

Arguments

testexpr

Expressiontobetested.

thenexpr

Expressionevaluatediftestexprisnotnil.

elseexpr

Expressionevaluatediftestexprisnil.

ReturnValues

Theiffunctionreturnsthevalueoftheselectedexpression.Ifelseexprismissingandtestexprisnil,thenitreturnsnil.

ExamplesCommand:(if(=13)"YES!!""no.")

"no."

Command:(if(=2(+11))"YES!!")

"YES!!"

Command:(if(=2(+34))"YES!!")

nil

SeeAlsoTheprognfunction.

Page 238: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 239: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>IFunctions>

initdia

Forcesthedisplayofthenextcommand'sdialogbox

(initdia[dialogflag])

Currently,thefollowingcommandsmakeuseoftheinitdiafunction:ATTDEF,ATTEXT,BHATCH,BLOCK,COLOR,IMAGE,IMAGEADJUST,INSERT,LAYER,LINETYPE,MTEXT,PLOT,RENAME,STYLE,TOOLBAR,andVIEW.

Arguments

dialogflag

Aninteger.Ifthisargumentisnotpresentorispresentandnonzero,thenextuse(andnextuseonly)ofacommandwilldisplaythatcommand'sdialogboxratherthanitscommandlineprompts.Ifdialogflagiszero,anypreviouscalltothisfunctioniscleared,restoringthedefaultbehaviorofpresentingthecommandlineinterface.

ReturnValues

nil

Examples

IssuethePLOTcommandwithoutcallinginitdiafirst:Command:(command"_.PLOT")

plot

Enteralayoutname<Model>:nil

Enteralayoutname<Model>:

AutoCADpromptsforuserinputinthecommandwindow.

UsethefollowingsequenceoffunctioncallstomakeAutoCADdisplaythePlot

Page 240: less than or equalAutoLISP Functions

dialogbox:

(initdia)

(command"_.PLOT")

Pleasesendusyourcommentaboutthispage

Page 241: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>IFunctions>

initget

Establisheskeywordsforusebythenextuser-inputfunctioncall

(initget[bits][string])

Thefunctionsthathonorkeywordsaregetint,getreal,getdist,getangle,getorient,getpoint,getcorner,getkword,entsel,nentsel,andnentselp.Thegetstringfunctionistheonlyuser-inputfunctionthatdoesnothonorkeywords.

Thekeywordsarecheckedbythenextuser-inputfunctioncallwhentheuserdoesnotentertheexpectedtypeofinput(forexample,apointtogetpoint).Iftheuserinputmatchesakeywordfromthelist,thefunctionreturnsthatkeywordasastringresult.Theapplicationcantestforthekeywordsandperformtheactionassociatedwitheachone.Iftheuserinputisnotanexpectedtypeanddoesnotmatchakeyword,AutoCADaskstheusertotryagain.Theinitgetbitvaluesandkeywordsapplyonlytothenextuser-inputfunctioncall.

Ifinitgetsetsacontrolbitandtheapplicationcallsauser-inputfunctionforwhichthebithasnomeaning,thebitisignored.

Iftheuserinputfailsoneormoreofthespecifiedconditions(asinazerovaluewhenzerovaluesarenotallowed),AutoCADdisplaysamessageandaskstheusertotryagain.

Arguments

bits

Abit-codedintegerthatallowsordisallowscertaintypesofuserinput.Thebitscanbeaddedtogetherinanycombinationtoformavaluebetween0and255.Ifnobitsargumentissupplied,zero(noconditions)isassumed.Thebitvaluesareasfollows:1(bit0) Preventstheuserfromrespondingtotherequestbyenteringonly

Page 242: less than or equalAutoLISP Functions

ENTER.2(bit1) Preventstheuserfromrespondingtotherequestbyenteringzero.4(bit2) Preventstheuserfromrespondingtotherequestbyenteringanegativevalue.8(bit3) Allowstheusertoenterapointoutsidethecurrentdrawinglimits.Thisconditionappliestothenextuser-inputfunctioneveniftheAutoCADsystemvariableLIMCHECKiscurrentlyset.16(bit4) (Notcurrentlyused.)32(bit5) Usesdashedlineswhendrawingarubber-bandlineorbox.Forthosefunctionswithwhichtheusercanspecifyapointbyselectingalocationinthedrawingarea,thisbitvaluecausestherubber-bandlineorboxtobedashedinsteadofsolid.(Somedisplaydriversuseadistinctivecolorinsteadofdashedlines.)IfthesystemvariablePOPUPSis0,AutoCADignoresthisbit.64(bit6) ProhibitsinputofaZcoordinatetothegetdistfunction;letsanapplicationensurethatthisfunctionreturnsa2Ddistance.128(bit7) Allowsarbitraryinputasifitisakeyword,firsthonoringanyothercontrolbitsandlistedkeywords.Thisbittakesprecedenceoverbit0;ifbits7and0aresetandtheuserpressesENTER,anullstringisreturned.256(bit8) Givedirectdistanceinputprecedenceoverarbitraryinput.Forexternalapplications,arbitraryinputisgivenprecedenceoverdirectdistanceinputbydefault.SetthisbitifyouwishtoforceAutoCADtoevaluateuserinputasdirectdistanceinput.Notethatlegalpointinputfromthekeyboardalwaystakesprecedenceovereitherdirectdistanceorarbitraryinput.512(bit9) Ifsetbeforeacalltogetpointorgetcorner,atemporaryUCSwillbeestablishedwhenthecursorcrossesovertheedgeofaplanarfaceofasolid.ThetemporaryUCSisresetwhenthecursormovesoffofaface.Itisdynamicallyre-establishedwhenthecursormovesoveradifferentface.Afterthepointisacquired,thedynamicUCSisresettothecurrentUCS.Thisfunctionalityisnotenabledfornon-planarfacessuchasthesideofacylinder.1024(bit10) Whencallinggetdist,getangle,getorient,getpoint,orgetcorner,youmaynotwantthedistance,angle,orient,point,orcornertobeinfluencedbyortho,polar,orotrackingintheZdirection.Settingthisbitbeforecallstoanyofthesefunctionswilltemporarilydisableortho,polar,andotrackingintheZdirection.Thisis

Page 243: less than or equalAutoLISP Functions

usefulwhenyoucreate2DentitiessuchasPLINE,ARC,orCIRCLE,orwhenyouusetheARRAYcommand,whichcreatesonlya2Darray.In2D-onlycommandsitcanbeconfusinganderror-pronetoallow3DpointstobeenteredusingorthoZ,polarZ,orotrackZ.

Note FutureversionsofAutoLISPmayuseadditionalinitgetcontrolbits,soavoidsettingbitsthatarenotlistedhere.

string

Astringrepresentingaseriesofkeywords.See“KeywordSpecifications”forinformationondefiningkeywords.

ReturnValues

nil

FunctionApplicableControlBits

Thespecialcontrolvaluesarehonoredonlybythosegetxxxfunctionsforwhichtheymakesense,asindicatedinthefollowingtable:

User-inputfunctionsandapplicablecontrolbits

Controlbitsvalues

Function

Honors

key

words

No

null

(1)

No

zero

(2)

No

negative

(4)

No

limits

(8)

Uses

dashes

(32)

getint X X X X

getreal X X X X

getdist X X X X X

getangle X X X X

getorient X X X X

Page 244: less than or equalAutoLISP Functions

getpoint X X X X

getcorner X X X X

getkword X X

entsel X

nentsel X

nentselp X

User-inputfunctionsandapplicablecontrolbits(continued)

Controlbitsvalues

Function

2D

distance

(64)

Arbitrary

input

(128)

Direct

distance

(256)

UCSface

tracking

(512)

Disable

Z-tracking

(1024)

getint X

getreal X

getdist X X X X

getangle X X X

getorient X X X

getpoint X X X X

getcorner X X X X

Page 245: less than or equalAutoLISP Functions

getkword X

entsel

nentsel

nentselp

KeywordSpecifications

Thestringargumentisinterpretedaccordingtothefollowingrules:

1. Eachkeywordisseparatedfromthefollowingkeywordbyoneormorespaces.Forexample,"WidthHeightDepth"definesthreekeywords.

2. Eachkeywordcancontainonlyletters,numbers,andhyphens(-).

Therearetwomethodsforabbreviatingkeywords:

Therequiredportionofthekeywordisspecifiedinuppercasecharacters,andtheremainderofthekeywordisspecifiedinlowercasecharacters.Theuppercaseabbreviationcanbeanywhereinthekeyword(forexample,"LType","eXit",or"toP").

Theentirekeywordisspecifiedinuppercasecharacters,anditisfollowedimmediatelybyacomma,whichisfollowedbytherequiredcharacters(forexample,"LTYPE,LT").Thekeywordcharactersinthiscasemustincludethefirstletterofthekeyword,whichmeansthat"EXIT,X"isnotvalid.

Thetwobriefexamples,"LType"and"LTYPE,LT",areequivalent:iftheusertypesLT(ineitheruppercaseorlowercaseletters),thisissufficienttoidentifythekeyword.Theusercanentercharactersthatfollowtherequiredportionofthekeyword,providedtheydon'tconflictwiththespecification.Intheexample,theusercouldalsoenterLTYorLTYP,butLwouldnotbesufficient.

Ifstringshowsthekeywordentirelyinuppercaseorlowercasecharacterswithnocommafollowedbyarequiredpart,AutoCADrecognizesthekeywordonlyiftheuserentersallofit.

Page 246: less than or equalAutoLISP Functions

Theinitgetfunctionprovidessupportforlocalizedkeywords.Thefollowingsyntaxforthekeywordstringallowsinputofthelocalizedkeywordwhileitreturnsthelanguageindependentkeyword:

"local1local2localn_indep1indep2indepn"

wherelocal1throughlocalnarethelocalizedkeywords,andindep1throughindepnarethelanguage-independentkeywords.

Theremustalwaysbethesamenumberoflocalizedkeywordsaslanguage-independentkeywords,andthefirstlanguage-independentkeywordisprefixedbyanunderscoreasshowninthefollowingexample:

(initget"AbcDef_GhiJkl")

(getkword"\nEnteranoption(Abc/Def):")

EnteringAreturnsGhiandentering_JreturnsJkl.

SeeAlsoTheentsel,getangle,getcorner,getdist,getint,getkword,getorient,getpoint,getreal,getstring,nentsel,andnentselpfunctions.TheControlofUser-InputFunctionConditionstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 247: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>IFunctions>

inters

Findstheintersectionoftwolines

(interspt1pt2pt3pt4[onseg])

AllpointsareexpressedintermsofthecurrentUCS.Ifallfourpointargumentsare3D,interschecksfor3Dintersection.Ifanyofthepointsare2D,intersprojectsthelinesontothecurrentconstructionplaneandchecksonlyfor2Dintersection.

Arguments

pt1

Oneendpointofthefirstline.

pt2

Theotherendpointofthefirstline.

pt3

Oneendpointofthesecondline.

pt4

Theotherendpointofthesecondline.

onseg

Ifspecifiedasnil,thelinesdefinedbythefourptargumentsareconsideredinfiniteinlength.Iftheonsegargumentisomittedorisnotnil,theintersectionpointmustlieonbothlinesorintersreturnsnil.

ReturnValues

Iftheonsegargumentispresentandisnil,intersreturnsthepointwhere

Page 248: less than or equalAutoLISP Functions

thelinesintersect,evenifthatpointisofftheendofoneorbothofthelines.Iftheonsegargumentisomittedorisnotnil,theintersectionpointmustlieonbothlinesorintersreturnsnil.Theintersfunctionreturnsnilifthetwolinesdonotintersect.

Examples

(setqa'(1.01.0)b'(9.09.0))

(setqc'(4.01.0)d'(4.02.0))

Command:(intersabcd)

nil

Command:(intersabcdT)

nil

Command:(intersabcdnil)

(4.04.0)

Pleasesendusyourcommentaboutthispage

Page 249: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>IFunctions>

itoa

Returnstheconversionofanintegerintoastring

(itoaint)

Arguments

int

Aninteger.

ReturnValues

Astringderivedfromint.

ExamplesCommand:(itoa33)

"33"

Command:(itoa-17)

"-17"

SeeAlsoTheatoifunction.

Pleasesendusyourcommentaboutthispage

Page 250: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

LFunctions

lambdaDefinesananonymousfunctionlastReturnsthelastelementinalistlayoutlistReturnsalistofallpaperspacelayoutsinthecurrentdrawinglayerstate-addlayersAddsorupdatesaseriesoflayerstoalayerstatelayerstate-deleteDeletesalayerstatelayerstate-exportExportsalayerstatetoaspecifiedfilelayerstate-getlayersReturnsthelayerssavedinalayerstatelayerstate-hasChecksifalayerstateispresentlayerstate-importImportsalayerstatefromaspecifiedfilelayerstate-renameRenamesalayerstatelayerstate-restoreRestoresalayerstateintothecurrentdrawinglayerstate-save

Page 251: less than or equalAutoLISP Functions

SavesalayerstateinthecurrentdrawinglengthReturnsanintegerindicatingthenumberofelementsinalistlistTakesanynumberofexpressionsandcombinesthemintoonelistlistpVerifiesthatanitemisalistloadEvaluatestheAutoLISPexpressionsinafileload_dialogLoadsaDCLfilelogReturnsthenaturallogofanumberasarealnumberlogandReturnstheresultofthelogicalbitwiseANDofalistofintegerslogiorReturnstheresultofthelogicalbitwiseinclusiveORofalistofintegerslshReturnsthelogicalbitwiseshiftofanintegerbyaspecifiednumberofbits

Pleasesendusyourcommentaboutthispage

Page 252: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

lambda

Definesananonymousfunction

(lambdaargumentsexpr...)

Usethelambdafunctionwhentheoverheadofdefininganewfunctionisnotjustified.Italsomakesyourintentionmoreapparentbylayingoutthefunctionatthespotwhereitistobeused.Thisfunctionreturnsthevalueofitslastexpr,andisoftenusedinconjunctionwithapplyand/ormapcartoperformafunctiononalist.

Arguments

arguments

Argumentspassedtoanexpression.

expr

AnAutoLISPexpression.

ReturnValues

Valueofthelastexpr.

Examples

ThefollowingexamplesdemonstratethelambdafunctionfromtheVisualLISPConsolewindow:

_$(apply'(lambda(xy

z)

(*x(-yz))

)

'(52014)

Page 253: less than or equalAutoLISP Functions

)30

_$(setqcounter0)

(mapcar'(lambda(x)

(setqcounter

(1+counter))

(*x5)

)

'(24-610.2)

)0

(1020-3051.0)

Pleasesendusyourcommentaboutthispage

Page 254: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

last

Returnsthelastelementinalist

(lastlst)

Arguments

lst

Alist.

ReturnValues

Anatomoralist.

ExamplesCommand:(last'(abcde))

E

Command:(last'(abc(de)))

(DE)

Pleasesendusyourcommentaboutthispage

Page 255: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layoutlist

Returnsalistofallpaperspacelayoutsinthecurrentdrawing

(layoutlist)

ReturnValues

Alistofstrings.

ExamplesCommand:(layoutlist)

("Layout1""Layout2")

Pleasesendusyourcommentaboutthispage

Page 256: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-addlayers

Addsorupdatesaseriesoflayerstoalayerstate

(layerstate-addlayerslayerstatename(listlayerstate

layernamestatecolorlinetypelineweightplotstyle))

Arguments

layerstatename

Astringspecifyingthenameofthelayerstatetobeupdated.

layername

Astringspecifyingthenameofthelayertobeaddedorupdated.

state

Anintegersumdesignatingpropertiesinthelayertobeset.1-Turnsthelayeroff2-Freezethelayer4-Lockthelayer8-FlagthelayerasNoPlot16-SetthelayerasbeingfrozeninnewviewportsAnilvalueusesdefaultsofon,thawed,unlocked,plottable,andthawedinnewviewports.

color

Adottedpairspecifyingthelayerscolortypeandvalue,e.g.(62.ColorIndex),(420.TrueColor),or(430."colorbook$colorname").

linetype

Astringspecifyingthenameofthelayerlinetype.Thelinetypemustalready

Page 257: less than or equalAutoLISP Functions

beloadedinthedrawingorthedefaultof"Continuous"willbeused.Anilvaluesetsthelayerlinetypeto"Continuous."

lineweight

Anintegercorrespondingtoavalidlineweight,i.e.,35=.35,211=2.11.Anilvaluesetsthelayerlineweightto"Default."

plotstyle

Astringspecifyingthenameofthelayersplotstyle.Theplotstylenamemustalreadybeloadedinthedrawingorthedefaultof"Normal"willbeused.Anilvaluesetsthelayerplotstyleto"Normal."Ifthedrawingisincolordependentmode,thissettingisignored.

ReturnValues

Tifsuccessful;otherwisenil

Examples

(layerstate-addlayers“myLayerState”(list“Walls”4'(62.45)“Divide”35“10%Screen”)

(list“Floors”6'(420.16235019)“Continuous”40“60%Screen”)

(list“Ceiling”0'(430.“RALCLASSIC$RAL1003”)“DOT”nilnil)))

T

Pleasesendusyourcommentaboutthispage

Page 258: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-delete

Deletesalayerstate

(layerstate-deletelayerstatename)

Arguments

layerstatename

Astringspecifyingthenameofthelayerstatetobedeleted.

ReturnValues

Tifthedeletesucceds;otherwisenil

Examples

(layerstate-delete“myLayerState”)

T

Pleasesendusyourcommentaboutthispage

Page 259: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-export

Exportsalayerstatetoaspecifiedfile

(layerstate-exportlayerstatenamefilename)

Arguments

layerstatename

Astringspecifyingthenameofthelayertoexport.

filename

Astringspecifyingthenameofthefiletowhichthelayerstateshouldbeexported.

ReturnValues

Tiftheexportissuccessful;nilotherwise.

Examples

(layerstate-export“myLayerState““c:\\mylayerstate.las“)

T

Pleasesendusyourcommentaboutthispage

Page 260: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-getlayers

Returnsthelayerssavedinalayerstate

(layerstate-getlayerslayerstatename[invert])

Arguments

layerstatename

Astringspecifyingthenameofthelayerstatetoqueryforlayers.

invert

Ifinvertisomittedornil,returnsalistofthelayerssavedinthelayerstate.IfinvertisT,itreturnsalistofthelayersinthedrawingthatarenotsavedinthelayerstate.

ReturnValues

Alistoflayernames.Returnsnilifthelayerstatedoesnotexistorcontainsnolayers.

Examples

(layerstate-getlayers“myLayerState“)

(“Layername1”“Layername2“)

Pleasesendusyourcommentaboutthispage

Page 261: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-has

Checksifalayerstateispresent

(layerstate-haslayerstatename)

Arguments

layerstatename

Astringspecifyingthenameofthelayerstatetobequeried.

ReturnValues

Tifthenameexists;otherwisenil

Examples

(layerstate-has“myLayerState”)

T

Pleasesendusyourcommentaboutthispage

Page 262: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-import

Importsalayerstatefromaspecifiedfile

(layerstate-importfilename)

Arguments

filename

Astringspecifyingthenameofthefilefromwhichtoimportalayerstate.

ReturnValues

Tiftheimportissuccessful;nilotherwise.

Examples

(layerstate-import“c:\\mylayerstate.las“)

T

Pleasesendusyourcommentaboutthispage

Page 263: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-rename

Renamesalayerstate

(layerstate-renameoldlayerstatenamenewlayerstatename)

Arguments

oldlayerstatename

Astringspecifyingthenameofthelayerstatetoberenamed.

newlayerstatename

Astringspecifyingthenameofthelayerstatetobeupdated.

ReturnValues

Tiftherenameissuccessful;otherwisenil

Examples

(layerstate-rename“myLayerState““myNewLayerState“)

T

Pleasesendusyourcommentaboutthispage

Page 264: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-restore

Restoresalayerstateintothecurrentdrawing

(layerstate-restorelayerstatenameviewport

[restoreflags])

Arguments

layerstatename

Astringspecifyingthenameofthelayertorestore.

viewport

Anename(ads_name)oftheviewporttowhichlayerstatenameshouldberestored.Ifviewportisnil,thelayerstateisrestoredtomodelspace.

restoreflags

Optionalintegersumaffectinghowthelayerstateisrestored.1-Turnoffalllayersnotintherestoredlayerstate2-Freezealllayersnotintherestoredlayerstate4-Restorethelayerstatepropertiesasviewportoverrides(requiresviewporttobenotanilvalue).

ReturnValues

nilifthelayerstatedoesnotexistorcontainsnolayers;otherwise,returnsalistoflayernames.

Examples

(layerstate-restore“myLayerState“viewportId5)

(“Layername1”“Layername2“)

Page 265: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 266: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

layerstate-save

Savesalayerstateinthecurrentdrawing

(layerstate-savelayerstatenamemaskviewport)

Arguments

layerstatename

Astringspecifyingthenameofthelayerstatetosave.

mask

Anintegersumdesignatingwhichpropertiesinthelayerstatearetoberestored.1-RestorethesavedOnorOffvalue2-RestorethesavedFrozenorThawedvalue4-RestorethesavedLockvalue8-RestorethesavedPlotorNoPlotvalue16-RestorethesavedVPVSDFLTvalue32-RestorethesavedColor64-RestorethesavedLineType128-RestorethesavedLineWeight

viewport

Anename(ads_name)oftheviewportwhoseVPLAYERsettingistobecaptured.Ifnil,thelayerstatewillbesavedwithoutVPLAYERsettings.

ReturnValues

Tifthesaveissuccessful;otherwisenil

Examples

Page 267: less than or equalAutoLISP Functions

(layerstate-save“myLayerState“21viewportId)

T

(layerstate-save“myLayerState“nilnil)

nil

Pleasesendusyourcommentaboutthispage

Page 268: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

length

Returnsanintegerindicatingthenumberofelementsinalist

(lengthlst)

Arguments

lst

Alist.

ReturnValues

Aninteger.

ExamplesCommand:(length'(abcd))

4

Command:(length'(ab(cd)))

3

Command:(length'())

0

SeeAlsoThevl-list-lengthfunction.

Pleasesendusyourcommentaboutthispage

Page 269: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

list

Takesanynumberofexpressionsandcombinesthemintoonelist

(list[expr...])

Thisfunctionisfrequentlyusedtodefinea2Dor3Dpointvariable(alistoftwoorthreereals).

Arguments

expr

AnAutoLISPexpression.

ReturnValues

Alist,unlessnoexpressionsaresupplied,inwhichcaselistreturnsnil.

Examples

_$(list'a'b'c)(ABC)

_$(list'a'(bc)'d)(A(BC)D)

_$(list3.96.7)(3.96.7)

Asanalternativetousingthelistfunction,youcanexplicitlyquotealistwiththequotefunctioniftherearenovariablesorundefineditemsinthelist.Thesinglequotecharacter(')isdefinedasthequotefunction.

_$'(3.96.7)meansthesameas(list3.96.7)

Thiscanbeusefulforcreatingassociationlistsanddefiningpoints.

Page 270: less than or equalAutoLISP Functions

SeeAlsoThequote,vl-list*,andvl-list-lengthfunctions.

Pleasesendusyourcommentaboutthispage

Page 271: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

listp

Verifiesthatanitemisalist

(listpitem)

Arguments

item

Anyatom,list,orexpression.

ReturnValues

Tifitemisalist;otherwisenil.Becausenilisbothanatomandalist,thelistpfunctionreturnsTwhenpassednil.

ExamplesCommand:(listp'(abc))

T

Command:(listp'a)

nil

Command:(listp4.343)

nil

Command:(listpnil)

T

Command:(listp(setqv1'(1243)))

T

SeeAlsoThevl-list*andvl-list-lengthfunctions.

Page 272: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 273: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

load

EvaluatestheAutoLISPexpressionsinafile

(loadfilename[onfailure])

TheloadfunctioncanbeusedfromwithinanotherAutoLISPfunction,orevenrecursively(inthefilebeingloaded).

Arguments

filename

Astringthatrepresentsthefilename.Ifthefilenameargumentdoesnotspecifyafileextension,loadaddsanextensiontothenamewhensearchingforafiletoload.Thefunctionwilltryseveralextensions,ifnecessary,inthefollowingorder:

.vlx

.fas

.lspAssoonasloadfindsamatch,itstopssearchingandloadsthefile.Thefilenamecanincludeadirectoryprefix,asin“c:/function/test1”.Aforwardslash(/)ortwobackslashes(\\)arevaliddirectorydelimiters.Ifyoudon'tincludeadirectoryprefixinthefilenamestring,loadsearchestheAutoCADlibrarypathforthespecifiedfile.Ifthefileisfoundanywhereonthispath,loadthenloadsthefile.

onfailure

Avaluereturnedifloadfails.IftheonfailureargumentisavalidAutoLISPfunction,itisevaluated.Inmostcases,theonfailureargumentshouldbeastringoranatom.This

Page 274: less than or equalAutoLISP Functions

allowsanAutoLISPapplicationcallingloadtotakealternativeactionuponfailure.

ReturnValues

Unspecified,ifsuccessful.Ifloadfails,itreturnsthevalueofonfailure;ifonfailureisnotdefined,failureresultsinanerrormessage.

Examples

Forthefollowingexamples,assumethatfile/fred/test1.lspcontainstheexpressions

(defunMY-FUNC1(x)

...functionbody...

)

(defunMY-FUNC2(x)

...functionbody...

andthatnofilenamedtest2witha.lsp,.fas,or.vlxextensionexists:Command:(load"/fred/test1")

MY-FUNC2

Command:(load"\\fred\\test1")

MY-FUNC2

Command:(load"/fred/test1""bad")

MY-FUNC2

Command:(load"test2""bad")

"bad"

Command:(load"test2")causesanAutoLISPerror

SeeAlsoThedefunandvl-load-allfunctions.TheSymbolandFunctionHandlingtopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 275: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

load_dialog

LoadsaDCLfile

(load_dialogdclfile)

Theload_dialogfunctionsearchesforfilesaccordingtotheAutoCADlibrarysearchpath.

Thisfunctionisthecomplementofunload_dialog.AnapplicationcanloadmultipleDCLfileswithmultipleload_dialogcalls.

Arguments

dclfile

AstringthatspecifiestheDCLfiletoload.Ifthedclfileargumentdoesnotspecifyafileextension,.dclisassumed.

ReturnValues

Apositiveintegervalue(dcl_id)ifsuccessful,oranegativeintegerifload_dialogcan'topenthefile.Thedcl_idisusedasahandleinsubsequentnew_dialogandunload_dialogcalls.

Pleasesendusyourcommentaboutthispage

Page 276: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

log

Returnsthenaturallogofanumberasarealnumber

(lognum)

Arguments

num

Apositivenumber.

ReturnValues

Arealnumber.

ExamplesCommand:(log4.5)

1.50408

Command:(log1.22)

0.198851

Pleasesendusyourcommentaboutthispage

Page 277: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

logand

ReturnstheresultofthelogicalbitwiseANDofalistofintegers

(logand[intint...])

Arguments

int

Aninteger.

ReturnValues

Aninteger(0,ifnoargumentsaresupplied).

ExamplesCommand:(logand7153)

3

Command:(logand2315)

2

Command:(logand834)

0

Pleasesendusyourcommentaboutthispage

Page 278: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

logior

ReturnstheresultofthelogicalbitwiseinclusiveORofalistofintegers

(logior[intint...])

Arguments

int

Aninteger.

ReturnValues

Aninteger(0,ifnoargumentsaresupplied).

ExamplesCommand:(logior124)

7

Command:(logior93)

11

Pleasesendusyourcommentaboutthispage

Page 279: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>LFunctions>

lsh

Returnsthelogicalbitwiseshiftofanintegerbyaspecifiednumberofbits

(lshintnumbits)

Arguments

int

Aninteger.

numbits

Numberofbitstoshiftint.Ifnumbitsispositive,intisshiftedtotheleft;ifnumbitsisnegative,intisshiftedtotheright.Ineithercase,zerobitsareshiftedin,andthebitsshiftedoutarediscarded.Ifnumbitsisnotspecified,noshiftoccurs.

ReturnValues

Thevalueofintafterthebitwiseshift.Thereturnedvalueispositiveifthesignificantbit(bitnumber31)containsa0aftertheshiftoperation;otherwiseitisnegative.Ifnoargumentsaresupplied,lshreturns0.

Thebehaviorisdifferentfromotherlanguages(>>&<<ofC,C++,orJava)wheremorethan32leftshifts(ofa32bitinteger)resultin0.Inrightshift,theintegerappearsagainonevery32shifts.

ExamplesCommand:(lsh21)

4

Command:(lsh2-1)

1

Page 280: less than or equalAutoLISP Functions

Command:(lsh402)

160

Pleasesendusyourcommentaboutthispage

Page 281: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

MFunctions

mapcarReturnsalistthatistheresultofexecutingafunctionwithalist(orlists)suppliedasargumentstothefunctionmaxReturnsthelargestofthenumbersgivenmemDisplaysthecurrentstateoftheAutoLISPmemorymemberSearchesalistforanoccurrenceofanexpressionandreturnstheremainderofthelist,startingwiththefirstoccurrenceoftheexpressionmenucmdIssuesmenucommands,orsetsandretrievesmenuitemstatusmenugroupVerifiesthatamenugroupisloadedminReturnsthesmallestofthenumbersgivenminuspVerifiesthatanumberisnegativemode_tileSetsthemodeofadialogboxtile

Pleasesendusyourcommentaboutthispage

Page 282: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

mapcar

Returnsalistthatistheresultofexecutingafunctionwithalist(orlists)suppliedasargumentstothefunction

(mapcarfunctionlist1...listn)

Arguments

function

Afunction.

list1...listn

Oneormorelists.Thenumberoflistsmustmatchthenumberofargumentsrequiredbyfunction.

ReturnValues

Alist.

ExamplesCommand:(setqa10b20c30)

30

Command:(mapcar'1+(listabc))

(112131)

Thisisequivalenttothefollowingseriesofexpressions,exceptthatmapcarreturnsalistoftheresults:

(1+a)

(1+b)

(1+c)

Thelambdafunctioncanspecifyananonymousfunctiontobeperformedby

Page 283: less than or equalAutoLISP Functions

mapcar.Thisisusefulwhensomeofthefunctionargumentsareconstantoraresuppliedbysomeothermeans.Thefollowingexample,enteredfromtheVisualLISPConsolewindow,demonstratestheuseoflambdawithmapcar:

_$(mapcar'(lambda(x)

(+x3)

)

'(102030)

)(132333)

Pleasesendusyourcommentaboutthispage

Page 284: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

max

Returnsthelargestofthenumbersgiven

(max[number

number...])

Arguments

number

Anumber.

ReturnValues

Anumber.Ifanyoftheargumentsarerealnumbers,arealisreturned;otherwiseanintegerisreturned.Ifnoargumentissupplied,maxreturns0.

ExamplesCommand:(max4.07-144)

4.07

Command:(max-881952)

19

Command:(max2.148)

8.0

Pleasesendusyourcommentaboutthispage

Page 285: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

mem

DisplaysthecurrentstateoftheAutoLISPmemory

(mem)

ThememfunctiondisplaysstatisticsonAutoLISPmemoryusage.Thefirstlineofthisstatisticsreportcontainsthefollowinginformation:

GCcalls

NumberofgarbagecollectioncallssinceAutoLISPstarted.

GCruntime

Totaltimespentcollectinggarbage(inmilliseconds).

LISPobjectsareallocatedindynamic(heap)memorythatisorganizedinsegmentsanddividedintopages.Memoryisdescribedundertheheading,“DynamicMemorySegmentsStatistics”:

PgSz

Dynamicmemorypagesize(inKB).

Used

Numberofpagesused.

Free

Numberoffree(empty)pages.

FMCL

Largestcontiguousareaoffreepages.

Segs

Numberofsegmentsallocated.

Page 286: less than or equalAutoLISP Functions

Type

Internaldescriptionofthetypesofobjectsallocatedinthissegment.Theseincludelispstacks—LISPinternalstacksbytecodearea—compiledcodefunctionmodulesCONSmemory—CONSobjects::new—untypedmemoryrequestsservedusingthissegmentDMStr—dynamicstringbodiesDMxxmemory—allotherLISPnodesbstackbody—internalstructureusedforIOoperations

Thefinallineinthereportliststheminimalsegmentsizeandthenumberofallocatedsegments.AutoLISPkeepsalistofnomorethanthreefreesegmentsinordertosavesystemcallsformemoryrequests.

Allheapmemoryisglobal;thatis,allAutoCADdocumentssharethesameheap.ThiscouldchangeinfuturereleasesofAutoCAD.

Notethatmemdoesnotlistallmemoryrequestedfromtheoperatingsystem;itlistsonlythoserequestsservedbytheAutoLISPDynamicMemory(DM)subsystem.SomeAutoLISPclassesdonotuseDMformemoryallocation.

ReturnValues

nil

ExamplesCommand:(mem)

;GCcalls:23;GCruntime:298ms

Dynamicmemorysegmentsstatistic:

PgSzUsedFreeFMCLSegsType

5127948481lispstacks

256370642314216bytecodearea

4096320101022CONSmemory

32769121310891::new

4096168121012DMStr

40962224415DMxxmemory

12845075071bstackbody

Segmentsize:65536,totalused:68,free:0

nil

Page 287: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 288: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

member

Searchesalistforanoccurrenceofanexpressionandreturnstheremainderofthelist,startingwiththefirstoccurrenceoftheexpression

(memberexprlst)

Arguments

expr

Theexpressiontobesearchedfor.

lst

Thelistinwhichtosearchforexpr.

ReturnValues

Alist;otherwisenil,ifthereisnooccurrenceofexprinlst.

ExamplesCommand:(member'c'(abcde))

(CDE)

Command:(member'q'(abcde))

nil

Pleasesendusyourcommentaboutthispage

Page 289: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

menucmd

Issuesmenucommands,orsetsandretrievesmenuitemstatus

(menucmdstring)

ThemenucmdfunctioncanswitchbetweensubpagesinanAutoCADmenu.Thisfunctioncanalsoforcethedisplayofmenus.ThisallowsAutoLISPprogramstouseimagetilemenusandtodisplayothermenusfromwhichtheusercanmakeselections.AutoLISPprogramscanalsoenable,disable,andplacemarksinmenuitems.

Arguments

string

Astringthatspecifiesamenuareaandthevaluetoassigntothatmenuarea.Thestringargumenthasthefollowingparameters:"menu_area=value"

Theallowedvaluesofmenu_area,showninthefollowinglist,arethesameastheyareinmenufilesubmenureferences.Formoreinformation,see“OverviewofPull-DownandShortcutMenus”intheCustomizationGuide.B1-B4 BUTTONSmenus1through4.A1-A4 AUXmenus1through4.P0-P16 Pull-down(POP)menus0through16.I Imagetilemenus.S SCREENmenu.T1-T4 TABLETmenus1through4.M DIESELstringexpressions.Gmenugroup.nametag Amenugroupandnametag.

ReturnValues

Page 290: less than or equalAutoLISP Functions

nil

Examples

ThefollowingcodedisplaystheimagetilemenuMOREICONS:

(menucmd"I=moreicons")Loads

theMOREICONSimagetilemenu

(menucmd"I=*")Displays

themenu

Thefollowingcodechecksthestatusofthethirdmenuiteminthepull-downmenuPOP11.Ifthemenuitemiscurrentlyenabled,themenucmdfunctiondisablesit.

(setqs(menucmd"P11.3=?"))Getsthestatusofthemenuitem

(if(=s"")Ifthestatusisanemptystring,

(menucmd"P11.3=~")disablethemenuitem

)

Thepreviouscodeisnotfoolproof.Inadditiontobeingenabledordisabled,menuitemscanalsoreceivemarks.Thecode(menucmd"P11.3=?")couldreturn"!.",indicatingthatthemenuitemiscurrentlychecked.Thiscodewouldassumethatthemenuitemisdisabledandcontinuewithoutdisablingit.Ifthecodeincludedacalltothewcmatchfunction,itcouldcheckthestatusforanoccurrenceofthetilde(~)characterandthentakeappropriateaction.

ThemenucmdfunctionalsoallowsAutoLISPprogramstotakeadvantageoftheDIESELstringexpressionlanguage.SomethingscanbedonemoreeasilywithDIESELthanwiththeequivalentAutoLISPcode.Thefollowingcodereturnsastringcontainingthecurrentdayanddate:

(menucmd"M=$(edtime,$(getvar,date),DDDD\",\"DMONTHYYYY)")

returns"Sunday,16July1995"

SeeAlsoTheCustomizationGuideformoreinformationonusingAutoLISPtoaccessmenulabelstatus,andforinformationonusingDIESEL.

Pleasesendusyourcommentaboutthispage

Page 291: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

menugroup

Verifiesthatamenugroupisloaded

(menugroupgroupname)

Arguments

groupname

Astringthatspecifiesthemenugroupname.

ReturnValues

Ifgroupnamematchesaloadedmenugroup,thefunctionreturnsthegroupnamestring;otherwise,itreturnsnil.

Pleasesendusyourcommentaboutthispage

Page 292: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

min

Returnsthesmallestofthenumbersgiven

(min[number

number...])

Arguments

number

Anumber.

ReturnValues

Anumber.Ifanynumberargumentisareal,arealisreturned;otherwise,anintegerisreturned.Ifnoargumentissupplied,minreturns0.

ExamplesCommand:(min683-10.0)

-10.0

Command:(min732485)

2

Command:(min73.02485)

2.0

Command:(min246.7)

2.0

Pleasesendusyourcommentaboutthispage

Page 293: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

minusp

Verifiesthatanumberisnegative

(minuspnum)

Arguments

num

Anumber.

ReturnValues

Tifnumberisnegative;otherwisenil.

ExamplesCommand:(minusp-1)

T

Command:(minusp-4.293)

T

Command:(minusp830.2)

nil

Pleasesendusyourcommentaboutthispage

Page 294: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>MFunctions>

mode_tile

Setsthemodeofadialogboxtile

(mode_tilekeymode)

Arguments

key

Astringthatspecifiesthetile.Thekeyargumentiscase-sensitive.

mode

Anintegerthatcanbeoneofthefollowing:0 Enabletile1 Disabletile2 Setfocustotile3 Selecteditboxcontents4 Flipimagehighlightingonoroff

ReturnValuesnil

Pleasesendusyourcommentaboutthispage

Page 295: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

NFunctions

namedobjdictReturnstheentitynameofthecurrentdrawing'snamedobjectdictionary,whichistherootofallnongraphicalobjectsinthedrawingnentselPromptstheusertoselectanobject(entity)byspecifyingapoint,andprovidesaccesstothedefinitiondatacontainedwithinacomplexobjectnentselpProvidessimilarfunctionalitytothatofthenentselfunctionwithouttheneedforuserinputnew_dialogBeginsanewdialogboxanddisplaysit,andcanalsospecifyadefaultactionnotVerifiesthatanitemevaluatestonilnthReturnsthenthelementofalistnullVerifiesthatanitemisboundtonilnumberpVerifiesthatanitemisarealnumberoraninteger

Pleasesendusyourcommentaboutthispage

Page 296: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

namedobjdict

Returnstheentitynameofthecurrentdrawing'snamedobjectdictionary,whichistherootofallnongraphicalobjectsinthedrawing

(namedobjdict)

Usingthenamereturnedbythisfunctionandthedictionaryaccessfunctions,anapplicationcanaccessthenongraphicalobjectsinthedrawing.

Pleasesendusyourcommentaboutthispage

Page 297: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

nentsel

Promptstheusertoselectanobject(entity)byspecifyingapoint,andprovidesaccesstothedefinitiondatacontainedwithinacomplexobject

(nentsel[msg])

Thenentselfunctionpromptstheusertoselectanobject.ThecurrentObjectSnapmodeisignoredunlesstheuserspecificallyrequestsit.ToprovideadditionalsupportattheCommandprompt,nentselhonorskeywordsdefinedbyapreviouscalltoinitget.

Arguments

msg

Astringtobedisplayedasaprompt.Ifthemsgargumentisomitted,theSelectObjectpromptisissued.

ReturnValues

Whentheselectedobjectisnotcomplex(thatis,nota3Dpolylineorblock),nentselreturnsthesameinformationasentsel.However,iftheselectedobjectisa3Dpolyline,nentselreturnsalistcontainingthenameofthesubentity(vertex)andthepickpoint.Thisissimilartothelistreturnedbyentsel,exceptthatthenameoftheselectedvertexisreturnedinsteadofthepolylineheader.Thenentselfunctionalwaysreturnsthestartingvertexoftheselected3Dpolylinesegment.Pickingthethirdsegmentofthepolyline,forexample,returnsthethirdvertex.TheSeqendsubentityisneverreturnedbynentselfora3Dpolyline.

Note Alightweightpolyline(lwpolylineentity)isdefinedinthedrawingdatabaseasasingleentity;itdoesnotcontainsubentities.

Selectinganattributewithinablockreferencereturnsthenameoftheattribute

Page 298: less than or equalAutoLISP Functions

andthepickpoint.Whentheselectedobjectisacomponentofablockreferenceotherthananattribute,nentselreturnsalistcontainingfourelements.

Thefirstelementofthelistreturnedfrompickinganobjectwithinablockistheselectedentity'sname.

Thesecondelementisalistcontainingthecoordinatesofthepointusedtopicktheobject.

ThethirdelementiscalledtheModeltoWorldTransformationMatrix.Itisalistconsistingoffoursublists,eachofwhichcontainsasetofcoordinates.ThismatrixcanbeusedtotransformtheentitydefinitiondatapointsfromaninternalcoordinatesystemcalledtheModelCoordinateSystem(MCS),totheWorldCoordinateSystem(WCS).TheinsertionpointoftheblockthatcontainstheselectedentitydefinestheoriginoftheMCS.TheorientationoftheUCSwhentheblockiscreateddeterminesthedirectionoftheMCSaxes.

Note nentselistheonlyAutoLISPfunctionthatusesamatrixofthistype;thenentselpfunctionreturnsamatrixsimilartothoseusedbyotherAutoLISPandObjectARXfunctions.

Thefourthelementisalistcontainingtheentitynameoftheblockthatcontainstheselectedobject.Iftheselectedobjectisinanestedblock(ablockwithinablock),thelistalsocontainstheentitynamesofallblocksinwhichtheselectedobjectisnested,startingwiththeinnermostblockandcontinuingoutwarduntilthenameoftheblockthatwasinsertedinthedrawingisreported.

ForinformationaboutconvertingMCScoordinatestoWCS,seetheEntityContextandCoordinateTransformDatatopicinUsingAutoLISPtoManipulateAutoCADObjectsintheAutoLISPDeveloper'sGuide.

Examples

Drawa3Dpolylinewithmultiplelinesegments;thenloadandrunthefollowingfunctionandselectdifferentsegmentsoftheline.Pickoffthelineandthenpickthesamesegmentsagaintoseethesubentityhandle.Tryitwithalightweightpolylinetoseethedifference.

(defunc:subent()

(while

(setqEnt(entsel"\nPickanentity:"))

(print(strcat"Entityhandleis:"

(cdr(assoc5(entget(carEnt))))))

Page 299: less than or equalAutoLISP Functions

)

(while

(setqEnt(nentsel"\nPickanentityorsubEntity:"))

(print(strcat"EntityorsubEntityhandleis:"

(cdr(assoc5(entget(carEnt))))))

)

(prompt"\nDone.")

(princ)

)

SeeAlsoTheentsel,initget,andnentselpfunctions.TheEntityNameFunctionsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 300: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

nentselp

Providessimilarfunctionalitytothatofthenentselfunctionwithouttheneedforuserinput

(nentselp[msg][pt])

Arguments

msg

Astringtobedisplayedasaprompt.Ifthemsgargumentisomitted,theSelectobjectpromptisissued.

pt

Aselectionpoint.Thisallowsobjectselectionwithoutuserinput.

ReturnValues

Thenentselpfunctionreturnsa4×4transformationmatrix,definedasfollows:

Thefirstthreecolumnsofthematrixspecifyscalingandrotation.Thefourthcolumnisatranslationvector.

Thefunctionsthatuseamatrixofthistypetreatapointasacolumnvectorofdimension4.Thepointisexpressedinhomogeneouscoordinates,wherethefourthelementofthepointvectorisascalefactorthatisnormallysetto1.0.Thefinalrowofthematrix,thevector[M30M31M32M33],hasthenominalvalueof[0001];itiscurrentlyignoredbythefunctionsthatusethismatrixformat.Inthisconvention,applyingatransformationtoapointisamatrixmultiplicationthatappearsasfollows:

Thismultiplicationgivesustheindividualcoordinatesofthepointasfollows:

Astheseequationsshow,thescalefactorandthelastrowofthematrixhaveno

Page 301: less than or equalAutoLISP Functions

effectandareignored.

SeeAlsoTheinitgetandnentselfunctions.

Pleasesendusyourcommentaboutthispage

Page 302: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

new_dialog

Beginsanewdialogboxanddisplaysit,andcanalsospecifyadefaultaction

(new_dialogdlgnamedcl_id[action

[screen-pt]])

Arguments

dlgname

Astringthatspecifiesthedialogbox.

dcl_id

TheDCLfileidentifierobtainedbyload_dialog.

action

AstringthatcontainsanAutoLISPexpressiontouseasthedefaultaction.Ifyoudon'twanttodefineadefaultaction,specifyanemptystring("").Theactionargumentisrequiredifyouspecifyscreen-pt.Thedefaultactionisevaluatedwhentheuserpicksanactivetilethatdoesn'thaveanactionorcallbackexplicitlyassignedtoitbyaction_tileorinDCL.

screen-pt

A2DpointlistthatspecifiestheX,Ylocationofthedialogboxonthescreen.Thepointspecifiestheupper-leftcornerofthedialogbox.Ifyoupassthepointas'(-1-1),thedialogboxisopenedinthedefaultposition(thecenteroftheAutoCADdrawingarea).

ReturnValues

T,ifsuccessful;otherwisenil.

Page 303: less than or equalAutoLISP Functions

SeeAlsoTheManagingDialogBoxeschapteroftheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 304: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

not

Verifiesthatanitemevaluatestonil

(notitem)

Typically,thenullfunctionisusedforlists,andnotisusedforotherdatatypesalongwithsometypesofcontrolfunctions.

Arguments

item

AnAutoLISPexpression.

ReturnValues

Tifitemevaluatestonil;otherwisenil.

ExamplesCommand:(setqa123b"string"cnil)

nil

Command:(nota)

nil

Command:(notb)

nil

Command:(notc)

T

Command:(not'())

T

SeeAlsoThenullfunction.

Page 305: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 306: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

nth

Returnsthenthelementofalist

(nthnlst)

Arguments

n

Thenumberoftheelementtoreturnfromthelist(zeroisthefirstelement).

lst

Thelist.

ReturnValues

Thenthelementoflst.Ifnisgreaterthanthehighestelementnumberoflst,nthreturnsnil.

ExamplesCommand:(nth3'(abcde))

D

Command:(nth0'(abcde))

A

Command:(nth5'(abcde))

nil

Pleasesendusyourcommentaboutthispage

Page 307: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

null

Verifiesthatanitemisboundtonil

(nullitem)

Arguments

item

AnAutoLISPexpression.

ReturnValues

Tifitemevaluatestonil;otherwisenil.

ExamplesCommand:(setqa123b"string"cnil)

nil

Command:(nulla)

nil

Command:(nullb)

nil

Command:(nullc)

T

Command:(null'())

T

SeeAlsoThenotfunction.

Pleasesendusyourcommentaboutthispage

Page 308: less than or equalAutoLISP Functions
Page 309: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>NFunctions>

numberp

Verifiesthatanitemisarealnumberoraninteger

(numberpitem)

Arguments

item

AnAutoLISPexpression.

ReturnValues

Tifitemevaluatestoarealoraninteger;otherwisenil.

ExamplesCommand:(setqa123b'a)

A

Command:(numberp4)

T

Command:(numberp3.8348)

T

Command:(numberp"Howdy")

nil

Command:(numberpa)

T

Command:(numberpb)

nil

Command:(numberp(evalb))

T

Page 310: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 311: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

OFunctions

openOpensafileforaccessbytheAutoLISPI/OfunctionsorReturnsthelogicalORofalistofexpressionsosnapReturnsa3DpointthatistheresultofapplyinganObjectSnapmodetoaspecifiedpoint

Pleasesendusyourcommentaboutthispage

Page 312: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>OFunctions>

open

OpensafileforaccessbytheAutoLISPI/Ofunctions

(openfilenamemode)

Arguments

filename

Astringthatspecifiesthenameandextensionofthefiletobeopened.Ifyoudonotspecifythefullpathnameofthefile,openassumesyouarereferringtotheAutoCADdefaultdrawingdirectory.

mode

Indicateswhetherthefileisopenforreading,writing,orappending.Specifyastringcontainingoneofthefollowingletters:r Openforreading.w Openforwriting.Iffilenamedoesnotexist,anewfileiscreatedandopened.Iffilenamealreadyexists,itsexistingdataisoverwritten.Datapassedtoanopenfileisnotactuallywrittenuntilthefileisclosedwiththeclosefunction.a Openforappending.Iffilenamedoesnotexist,anewfileiscreatedandopened.Iffilenamealreadyexists,itisopenedandthepointerispositionedattheendoftheexistingdata,sonewdatayouwritetothefileisappendedtotheexistingdata.Themodeargumentcanbeuppercaseorlowercase.NotethatinreleasespriortoAutoCAD2000,modehadtobespecifiedinlowercase.

ReturnValues

Ifsuccessful,openreturnsafiledescriptorthatcanbeusedbytheotherI/Ofunctions.Ifmode"r"isspecifiedandfilenamedoesnotexist,openreturns

Page 313: less than or equalAutoLISP Functions

nil.

Note OnDOSsystems,someprogramsandtexteditorswritetextfileswithanend-of-filemarker(CTRL+Z,decimalASCIIcode26)attheendofthetext.Whenreadingatextfile,DOSreturnsanend-of-filestatusifaCTRL+Zmarkerisencountered,evenifthatmarkerisfollowedbymoredata.Ifyouintendtouseopen"a"modetoappenddatatofilesproducedbyanotherprogram,becertaintheotherprogramdoesnotinsertCTRL+Zmarkersattheendofitstextfiles.

Examples

Openanexistingfile:Command:(setqa(open"c:/programfiles/<AutoCADinstallationdirectory>/help/filelist.txt""r"))

#<file"c:/programfiles/<AutoCADinstallationdirectory>/help/filelist.txt">

Thefollowingexamplesissueopenagainstfilesthatdonotexist:Command:(setqf(open"c:\\mydocuments\\new.tst""w"))

#<file"c:\\mydocuments\\new.tst">

Command:(setqf(open"nosuch.fil""r"))

nil

Command:(setqf(open"logfile""a"))

#<file"logfile">

Pleasesendusyourcommentaboutthispage

Page 314: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>OFunctions>

or

ReturnsthelogicalORofalistofexpressions

(or[expr...])

Theorfunctionevaluatestheexpressionsfromlefttoright,lookingforanon-nilexpression.

Arguments

expr

Theexpressionstobeevaluated.

ReturnValues

T,ifanon-nilexpressionisfound;otherwisenil,ifalloftheexpressionsarenilornoargumentsaresupplied.

NotethatoracceptsanatomasanargumentandreturnsTifoneissupplied.

ExamplesCommand:(ornil45'())

T

Command:(ornil'())

nil

Pleasesendusyourcommentaboutthispage

Page 315: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>OFunctions>

osnap

Returnsa3DpointthatistheresultofapplyinganObjectSnapmodetoaspecifiedpoint

(osnapptmode)

Arguments

pt

Apoint.

mode

AstringthatconsistsofoneormorevalidObjectSnapidentifiers,suchasmid,cen,andsoon,separatedbycommas.

ReturnValues

Apoint;otherwisenil,ifthepickdidnotreturnanobject(forexample,ifthereisnogeometryunderthepickaperture,orifthegeometryisnotapplicabletotheselectedobjectsnapmode).Thepointreturnedbyosnapdependsonthecurrent3Dview,theAutoCADentityaroundpt,andthesettingoftheAPERTUREsystemvariableintheCommandReference.

ExamplesCommand:(setqpt1(getpoint))

(11.86373.282690.0)

Command:(setqpt2(osnappt1"_end,_int"))

(12.14243.421810.0)

Pleasesendusyourcommentaboutthispage

Page 316: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

PFunctions

polarReturnstheUCS3Dpointataspecifiedangleanddistancefromapointprin1PrintsanexpressiontothecommandlineorwritesanexpressiontoanopenfileprincPrintsanexpressiontothecommandline,orwritesanexpressiontoanopenfileprintPrintsanexpressiontothecommandline,orwritesanexpressiontoanopenfileprognEvaluateseachexpressionsequentiallyandreturnsthevalueofthelastexpressionpromptDisplaysastringonyourscreen'spromptarea

Pleasesendusyourcommentaboutthispage

Page 317: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

polar

ReturnstheUCS3Dpointataspecifiedangleanddistancefromapoint

(polarptangdist)

Arguments

pt

A2Dor3Dpoint.

ang

AnangleexpressedinradiansrelativetotheworldXaxis.Anglesincreaseinthecounterclockwisedirection,independentofthecurrentconstructionplane.

dist

Distancefromthespecifiedpt.

ReturnValues

A2Dor3Dpoint,dependingonthetypeofpointspecifiedbypt.

Examples

Supplyinga3Dpointtopolar:Command:(polar'(113.5)0.7853981.414214)

(2.02.03.5)

Supplyinga2Dpointtopolar:Command:(polar'(11)0.7853981.414214)

(2.02.0)

Pleasesendusyourcommentaboutthispage

Page 318: less than or equalAutoLISP Functions
Page 319: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

prin1

Printsanexpressiontothecommandlineorwritesanexpressiontoanopenfile

(prin1[expr[file-desc]])

Arguments

expr

AstringorAutoLISPexpression.Onlythespecifiedexprisprinted;nonewlineorspaceisincluded.

file-desc

Afiledescriptorforafileopenedforwriting.

ReturnValues

Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,prin1returnsanullsymbol.

Usedasthelastexpressioninafunction,prin1withoutargumentsprintsablanklinewhenthefunctioncompletes,allowingthefunctiontoexit“quietly.”

ExamplesCommand:(setqa123b'(a))

(A)

Command:(prin1'a)

AA

ThepreviouscommandprintedAandreturnedA.Command:(prin1a)

123123

Thepreviouscommandprinted123andreturned123.

Page 320: less than or equalAutoLISP Functions

Command:(prin1b)

(A)(A)

Thepreviouscommandprinted(A)andreturned(A).

Eachprecedingexampleisdisplayedonthescreenbecausenofile-descwasspecified.Assumingthatfisavalidfiledescriptorforafileopenedforwriting,thefollowingfunctioncallwritesastringtothatfileandreturnsthestring:

Command:(prin1"Hello"f)

"Hello"

Ifexprisastringcontainingcontrolcharacters,prin1expandsthesecharacterswithaleading\,asshowninthefollowingtable:

Controlcodes

Code Description

\\ \character

\" "character

\e Escapecharacter

\n Newlinecharacter

\r Returncharacter

\t TABcharacter

\nnn Characterwhoseoctalcodeisnnn

Thefollowingexampleshowshowtousecontrolcharacters:Command:(prin1(chr2))

"\002""\002"

SeeAlso

Page 321: less than or equalAutoLISP Functions

DisplayingMessagesintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 322: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

princ

Printsanexpressiontothecommandline,orwritesanexpressiontoanopenfile

(princ[expr[file-desc]])

Thisfunctionisthesameasprin1,exceptcontrolcharactersinexprareprintedwithoutexpansion.Ingeneral,prin1isdesignedtoprintexpressionsinawaythatiscompatiblewithload,whileprincprintstheminawaythatisreadablebyfunctionssuchasread-line.

Arguments

expr

AstringorAutoLISPexpression.Onlythespecifiedexprisprinted;nonewlineorspaceisincluded.

file-desc

Afiledescriptorforafileopenedforwriting.

ReturnValues

Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,princreturnsanullsymbol.

SeeAlsoTheDisplayingMessagestopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 323: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

print

Printsanexpressiontothecommandline,orwritesanexpressiontoanopenfile

(print[expr[file-desc]])

Thisfunctionisthesameasprin1,exceptitprintsanewlinecharacterbeforeexpr,andprintsaspacefollowingexpr.

Arguments

expr

AstringorAutoLISPexpression.Onlythespecifiedexprisprinted;nonewlineorspaceisincluded.

file-desc

Afiledescriptorforafileopenedforwriting.

ReturnValues

Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,printreturnsanullsymbol.

SeeAlsoTheDisplayingMessagestopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 324: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

progn

Evaluateseachexpressionsequentiallyandreturnsthevalueofthelastexpression

(progn[expr]...)

Youcanuseprogntoevaluateseveralexpressionswhereonlyoneexpressionisexpected.

Arguments

expr

OneormoreAutoLISPexpressions.

ReturnValues

Theresultofthelastevaluatedexpression.

Examples

Theiffunctionnormallyevaluatesonethenexpressionifthetestexpressionevaluatestoanythingbutnil.Thefollowingexampleusesprogntoevaluatetwoexpressionsfollowingif:

(if(=ab)

(progn

(princ"\nA=B")

(setqa(+a10)b(-b10))

)

)

SeeAlsoTheiffunction.

Page 325: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 326: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>PFunctions>

prompt

Displaysastringonyourscreen'spromptarea

(promptmsg)

Ondual-screenAutoCADconfigurations,promptdisplaysmsgonbothscreensandis,therefore,preferabletoprinc.

Arguments

msg

Astring.

ReturnValues

nil

ExamplesCommand:(prompt"Newvalue:")

Newvalue:nil

SeeAlsoTheDisplayingMessagestopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 327: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

QFunctions

quitForcesthecurrentapplicationtoquitquoteReturnsanexpressionwithoutevaluatingit

Pleasesendusyourcommentaboutthispage

Page 328: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>QFunctions>

quit

Forcesthecurrentapplicationtoquit

(quit)

Ifquitiscalled,itreturnstheerrormessagequit/exitabortandreturnstotheAutoCADCommandprompt.

SeeAlsoTheexitfunction.

Pleasesendusyourcommentaboutthispage

Page 329: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>QFunctions>

quote

Returnsanexpressionwithoutevaluatingit

(quoteexpr)

Arguments

expr

AnAutoLISPexpression.

ReturnValues

Theexprargument.

ExamplesCommand:(quotea)

A

Thepreviousexpressioncanalsobewrittenas'a.Forexample:Command:!'a

A

Command:(quote(ab))

(AB)

SeeAlsoThefunctionfunction.

Pleasesendusyourcommentaboutthispage

Page 330: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

RFunctions

readReturnsthefirstlistoratomobtainedfromastringread-charReturnsthedecimalASCIIcoderepresentingthecharacterreadfromthekeyboardinputbufferorfromanopenfileread-lineReadsastringfromthekeyboardorfromanopenfile,untilanend-of-linemarkerisencounteredredrawRedrawsthecurrentviewportoraspecifiedobject(entity)inthecurrentviewportregappRegistersanapplicationnamewiththecurrentAutoCADdrawinginpreparationforusingextendedobjectdataremDividesthefirstnumberbythesecond,andreturnstheremainderrepeatEvaluateseachexpressionaspecifiednumberoftimes,andreturnsthevalueofthelastexpressionreverseReturnsacopyofalistwithitselementsreversedrtosConvertsanumberintoastring

Page 331: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 332: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

read

Returnsthefirstlistoratomobtainedfromastring

(read[string])

ThereadfunctionparsesthestringrepresentationofanyLISPdataandreturnsthefirstexpressioninthestring,convertingittoacorrespondingdatatype.

Arguments

string

Astring.Thestringargumentshouldnotcontainblanks,exceptwithinalistorstring.

ReturnValues

Alistoratom.Thereadfunctionreturnsitsargumentconvertedintothecorrespondingdatatype.Ifnoargumentisspecified,readreturnsnil.

IfthestringcontainsmultipleLISPexpressionsseparatedbyLISPsymboldelimiterssuchasblanks,newline,tabs,orparentheses,onlythefirstexpressionisreturned.

ExamplesCommand:(read"hello")

HELLO

Command:(read"hellothere")

HELLO

Command:(read"\"HiY'all\"")

"HiY'all"

Command:(read"(abc)")

(ABC)

Command:(read"(abc)(d)")

Page 333: less than or equalAutoLISP Functions

(ABC)

Command:(read"1.2300")

1.23

Command:(read"87")

87

Command:(read"873.2")

87

Pleasesendusyourcommentaboutthispage

Page 334: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

read-char

ReturnsthedecimalASCIIcoderepresentingthecharacterreadfromthekeyboardinputbufferorfromanopenfile

(read-char[file-desc])

Arguments

file-desc

Afiledescriptor(obtainedfromopen)referringtoanopenfile.Ifnofile-descisspecified,read-charobtainsinputfromthekeyboardinputbuffer.

ReturnValues

AnintegerrepresentingtheASCIIcodeforacharacter.Theread-charfunctionreturnsasinglenewlinecharacter(ASCIIcode10)wheneveritdetectsanend-of-linecharacterorcharactersequence.

Examples

Thefollowingexampleomitsfile-desc,soread-charlooksfordatainthekeyboardbuffer:

Command:(read-char)

Thekeyboardbufferisempty,soread-charwaitsforuserinput:

ABC65

TheuserenteredABC;read-charreturnedtheASCIIcoderepresentingthefirstcharacterentered(A).Thenextthreecallstoread-charreturnthedataremaininginthekeyboardinputbuffer.Thisdatatranslatesto66(theASCIIcodefortheletterB),67(C),and10(newline),respectively:

Page 335: less than or equalAutoLISP Functions

Command:(read-char)

66

Command:(read-char)

67

Command:(read-char)

10

Withthekeyboardinputbuffernowempty,read-charwaitsforuserinputthenexttimeitiscalled:

Command:(read-char)

Pleasesendusyourcommentaboutthispage

Page 336: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

read-line

Readsastringfromthekeyboardorfromanopenfile,untilanend-of-linemarkerisencountered

(read-line[file-desc])

Arguments

file-desc

Afiledescriptor(obtainedfromopen)referringtoanopenfile.Ifnofile-descisspecified,read-lineobtainsinputfromthekeyboardinputbuffer.

ReturnValues

Thestringreadbyread-line,withouttheend-of-linemarker.Ifread-lineencounterstheendofthefile,itreturnsnil.

Examples

Openafileforreading:Command:(setqf(open"c:\\mydocuments\\new.tst""r"))

#<file"c:\\mydocuments\\new.tst">

Useread-linetoreadalinefromthefile:Command:(read-linef)

"Toboldlygowherenomadhasgonebefore."

Obtainalineofinputfromtheuser:Command:(read-line)

Toboldlygo

"Toboldlygo"

Page 337: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 338: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

redraw

Redrawsthecurrentviewportoraspecifiedobject(entity)inthecurrentviewport

(redraw[ename[mode]])

Ifredrawiscalledwithnoarguments,thefunctionredrawsthecurrentviewport.Ifcalledwithanentitynameargument,redrawredrawsthespecifiedentity.

Theredrawfunctionhasnoeffectonhighlightedorhiddenentities;however,aREGENcommandforcestheentitiestoredisplayintheirnormalmanner.

Arguments

ename

Thenameoftheentitynametoberedrawn.

mode

Anintegervaluethatcontrolsthevisibilityandhighlightingoftheentity.Themodecanbeoneofthefollowingvalues:1 Showentity2 Hideentity(blankitout)3 Highlightentity4 UnhighlightentityTheuseofentityhighlighting(mode3)mustbebalancedwithentityunhighlighting(mode4).

Ifenameistheheaderofacomplexentity(apolylineorablockreferencewithattributes),redrawprocessesthemainentityandallitssubentitiesifthemodeargumentispositive.Ifthemodeargumentisnegative,redrawoperateson

Page 339: less than or equalAutoLISP Functions

onlytheheaderentity.

ReturnValues

Theredrawfunctionalwaysreturnsnil.

Pleasesendusyourcommentaboutthispage

Page 340: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

regapp

RegistersanapplicationnamewiththecurrentAutoCADdrawinginpreparationforusingextendedobjectdata

(regappapplication)

Arguments

application

Astringnamingtheapplication.Thenamemustbeavalidsymboltablename.SeethedescriptionofsnvalidfortherulesAutoLISPusestodetermineifasymbolnameisvalid.

ReturnValues

Ifanapplicationofthesamenamehasalreadybeenregistered,thisfunctionreturnsnil;otherwiseitreturnsthenameoftheapplication.

Ifregisteredsuccessfully,theapplicationnameisenteredintotheAPPIDsymboltable.Thistablemaintainsalistoftheapplicationsthatareusingextendeddatainthedrawing.

Examples

(regapp"ADESK_4153322344")

(regapp"DESIGNER-v2.1-124753")

Note Itisrecommendedthatyoupickauniqueapplicationname.Onewayofensuringthisistoadoptanamingschemethatusesthecompanyorproductnameandauniquenumber(likeyourtelephonenumberorthecurrentdate/time).Theproductversionnumbercanbeincludedintheapplicationnameorstoredbytheapplicationinaseparateintegerorreal-numberfield;forexample,(10402.1).

Page 341: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 342: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

rem

Dividesthefirstnumberbythesecond,andreturnstheremainder

(rem[numbernumber...])

Arguments

number

Anynumber.Ifyouprovidemorethantwonumbers,remdividestheresultofdividingthefirstnumberbythesecondwiththethird,andsoon.Ifyouprovidemorethantwonumbers,remevaluatestheargumentsfromlefttoright.Forexample,ifyousupplythreenumbers,remdividesthefirstnumberbythesecond,thentakestheresultanddividesitbythethirdnumber,returningtheremainderofthatoperation.

ReturnValues

Anumber.Ifanynumberargumentisareal,remreturnsareal;otherwise,remreturnsaninteger.Ifnoargumentsaresupplied,remreturns0.Ifasinglenumberargumentissupplied,remreturnsnumber.

ExamplesCommand:(rem4212)

6

Command:(rem12.016)

12.0

Command:(rem2672)

1

Page 343: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 344: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

repeat

Evaluateseachexpressionaspecifiednumberoftimes,andreturnsthevalueofthelastexpression

(repeatint[expr...])

Arguments

int

Aninteger.Mustbeapositivenumber.

expr

Oneormoreatomsorexpressions.

ReturnValues

Thevalueofthelastexpressionoratomevaluated.Ifexprisnotsupplied,repeatreturnsnil.

ExamplesCommand:(setqa10b100)

100

Command:(repeat4(setqa(+a10))(setqb(+b100)))

500

Afterevaluation,ais50,bis500,andrepeatreturns500.

Ifstringsaresuppliedasarguments,repeatreturnsthelaststring:Command:(repeat100"Me""You")

"You"

Pleasesendusyourcommentaboutthispage

Page 345: less than or equalAutoLISP Functions
Page 346: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

reverse

Returnsacopyofalistwithitselementsreversed

(reverselst)

Arguments

lst

Alist.

ReturnValues

Alist.

ExamplesCommand:(reverse'((a)bc))

(CB(A))

Pleasesendusyourcommentaboutthispage

Page 347: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>RFunctions>

rtos

Convertsanumberintoastring

(rtosnumber[mode[precision]])

Thertosfunctionreturnsastringthatistherepresentationofnumberaccordingtothesettingsofmode,precision,andthesystemvariablesUNITMODE,DIMZIN,LUNITS,andLUPREC.

Arguments

number

Anumber.

mode

Anintegerspecifyingthelinearunitsmode.ThemodecorrespondstothevaluesallowedfortheLUNITSAutoCADsystemvariable.Themodecanbeoneofthefollowingnumbers:1 Scientific2 Decimal3 Engineering(feetanddecimalinches)4 Architectural(feetandfractionalinches)5 Fractional

precision

Anintegerspecifyingtheprecision.

ThemodeandprecisionargumentscorrespondtothesystemvariablesLUNITSandLUPREC.Ifyouomitthearguments,rtosusesthecurrentsettingsofLUNITSandLUPREC.

Page 348: less than or equalAutoLISP Functions

ReturnValues

Astring.TheUNITMODEsystemvariableaffectsthereturnedstringwhenengineering,architectural,orfractionalunitsareselected(modevalues3,4,or5).

Examples

Setvariablex:Command:(setqx17.5)

17.5

Convertthevalueofxtoastringinscientificformat,withaprecisionof4:Command:(setqfmtval(rtosx14))

"1.7500E+01"

Convertthevalueofxtoastringindecimalformat,with2decimalplaces:Command:(setqfmtval(rtosx22))

"17.50"

Convertthevalueofxtoastringinengineeringformat,withaprecisionof2:Command:(setqfmtval(rtosx32))

"1'-5.50\""

Convertthevalueofxtoastringinarchitecturalformat:Command:(setqfmtval(rtosx42))

"1'-51/2\""

Convertthevalueofxtoastringinfractionalformat:Command:(setqfmtval(rtosx52))

"171/2"

SettingUNITMODEto1causesunitstobedisplayedasentered.Thisaffectsthevaluesreturnedbyrtosforengineering,architectural,andfractionalformats,asshowninthefollowingexamples:

Command:(setvar"unitmode"1)

1

Command:(setqfmtval(rtosx32))

"1'5.50\""

Command:(setqfmtval(rtosx42))

"1'5-1/2\""

Page 349: less than or equalAutoLISP Functions

Command:(setqfmtval(rtosx52))

"17-1/2"

SeeAlsoTheStringConversionstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 350: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

SFunctions

setSetsthevalueofaquotedsymbolnametoanexpressionset_tileSetsthevalueofadialogboxtilesetcfgWritesapplicationdatatotheAppDatasectionoftheacad*.cfgfilesetenvSetsasystemenvironmentvariabletoaspecifiedvaluesetfunhelpRegistersauser-definedcommandwiththeHelpfacilitysotheappropriateHelpfileandtopicarecalledwhentheuserrequestshelponthatcommandsetqSetsthevalueofasymbolorsymbolstoassociatedexpressionssetvarSetsanAutoCADsystemvariabletoaspecifiedvaluesetviewEstablishesaviewforaspecifiedviewportsinReturnsthesineofanangleasarealnumberexpressedinradiansslide_imageDisplaysanAutoCADslideinthecurrentlyactivedialogboximagetilesnvalid

Page 351: less than or equalAutoLISP Functions

ChecksthesymboltablenameforvalidcharacterssqrtReturnsthesquarerootofanumberasarealnumberssaddAddsanobject(entity)toaselectionset,orcreatesanewselectionsetssdelDeletesanobject(entity)fromaselectionsetssgetCreatesaselectionsetfromtheselectedobjectssgetfirstDetermineswhichobjectsareselectedandgrippedsslengthReturnsanintegercontainingthenumberofobjects(entities)inaselectionsetssmembTestswhetheranobject(entity)isamemberofaselectionsetssnameReturnstheobject(entity)nameoftheindexedelementofaselectionsetssnamexRetrievesinformationabouthowaselectionsetwascreatedsssetfirstSetswhichobjectsareselectedandgrippedstartappStartsaWindowsapplicationstart_dialogDisplaysadialogboxandbeginsacceptinguserinputstart_imageStartsthecreationofanimageinthedialogboxtilestart_list

Page 352: less than or equalAutoLISP Functions

Startstheprocessingofalistinthelistboxorinthepop-uplistdialogboxtilestrcaseReturnsastringwhereallalphabeticcharactershavebeenconvertedtouppercaseorlowercasestrcatReturnsastringthatistheconcatenationofmultiplestringsstrlenReturnsanintegerthatisthenumberofcharactersinastringsubstSearchesalistforanolditemandreturnsacopyofthelistwithanewitemsubstitutedinplaceofeveryoccurrenceoftheolditemsubstrReturnsasubstringofastring

Pleasesendusyourcommentaboutthispage

Page 353: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

set

Setsthevalueofaquotedsymbolnametoanexpression

(setsymexpr)

Thesetfunctionissimilartosetqexceptthatsetevaluatesbothofitsargumentswhereassetqonlyevaluatesitssecondargument.

Arguments

sym

Asymbol.

expr

AnAutoLISPexpression.

ReturnValues

Thevalueoftheexpression.

Examples

Eachofthefollowingcommandssetssymbolato5.0:

(set'a5.0)

(set(read"a")5.0)

(setqa5.0)

Bothsetandsetqexpectasymbolastheirfirstargument,butsetacceptsanexpressionthatreturnsasymbol,whereassetqdoesnot,asthefollowingshows:

Command:(set(read"a")5.0)

5.0

Command:(setq(read"a")5.0)

Page 354: less than or equalAutoLISP Functions

;***ERROR:syntaxerror

SeeAlsoThesetqfunction.

Pleasesendusyourcommentaboutthispage

Page 355: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

set_tile

Setsthevalueofadialogboxtile

(set_tilekeyvalue)

Arguments

key

Astringthatspecifiesthetile.

value

Astringthatnamesthenewvaluetoassign(initiallysetbythevalueattribute).

ReturnValues

Thevaluethetilewassetto.

Pleasesendusyourcommentaboutthispage

Page 356: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setcfg

WritesapplicationdatatotheAppDatasectionoftheacad*.cfgfile

(setcfgcfgnamecfgval)

Arguments

cfgname

Astringthatspecifiesthesectionandparametertosetwiththevalueofcfgval.Thecfgnameargumentmustbeastringofthefollowingform:

AppData/application_name/section_name/.../param_name

Thestringcanbeupto496characterslong.

cfgval

Astring.Thestringcanbeupto512charactersinlength.Largerstringsareacceptedbysetcfg,butcannotbereturnedbygetcfg.

ReturnValues

Ifsuccessful,setcfgreturnscfgval.Ifcfgnameisnotvalid,setcfgreturnsnil.

Examples

ThefollowingcodesetstheWallThkparameterintheAppData/ArchStuffsectionto8,andreturnsthestring“8”:

Command:(setcfg"AppData/ArchStuff/WallThk""8")

"8"

SeeAlsoThegetcfgfunction.

Page 357: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 358: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setenv

Setsasystemenvironmentvariabletoaspecifiedvalue

(setenvvarnamevalue)

Arguments

varname

Astringspecifyingthenameoftheenvironmentvariabletobeset.Environmentvariablenamesmustbespelledandcasedexactlyastheyarestoredinthesystemregistry.

value

Astringspecifyingthevaluetosetvarnameto.

ReturnValues

value

Examples

ThefollowingcommandsetsthevalueoftheMaxArrayenvironmentvariableto10000:

Command:(setenv"MaxArray""10000")

"10000"

NotethatchangestosettingsmightnottakeeffectuntilthenexttimeAutoCADisstarted.

SeeAlsoThegetenvfunction.

Page 359: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 360: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setfunhelp

Registersauser-definedcommandwiththeHelpfacilitysotheappropriateHelpfileandtopicarecalledwhentheuserrequestshelponthatcommand

(setfunhelpc:fname[helpfile[topic

[command]]])

Arguments

c:fname

Astringspecifyingtheuser-definedcommand(theC:XXXfunction).Youmustincludethec:prefix.

helpfile

AstringnamingtheHelpfile.Thefileextensionisnotrequiredwiththehelpfileargument.Ifafileextensionisprovided,AutoCADlooksonlyforafilewiththeexactnamespecified.Ifnofileextensionisprovided,AutoCADlooksforhelpfilewithanextensionof.chm.Ifnofileofthatnameisfound,AutoCADlooksforafilewithanextensionof.hlp.

topic

AstringidentifyingaHelptopicID.IfyouarecallingatopicwithinaCHMfile,providethefilenamewithouttheextension;AutoCADaddsan.htmextension.

command

AstringthatspecifiestheinitialstateoftheHelpwindow.ThecommandargumentisastringusedbytheuCommand(inHTMLHelp)orthefuCommand(inWinHelp)argumentoftheHtmlHelp()andWinHelp()functionsasdefinedintheMicrosoftWindowsSDK.

Page 361: less than or equalAutoLISP Functions

ForHTMLHelpfiles,thecommandparametercanbeHH_ALINK_LOOKUPorHH_DISPLAY_TOPIC.ForWindowsHelpfiles,thecommandparametercanbeHELP_CONTENTS,HELP_HELPONHELP,orHELP_PARTIALKEY.

ReturnValues

Thestringpassedasc:fname,ifsuccessful;otherwise,nil.

Thisfunctionverifiesonlythatthec:fnameargumenthasthec:prefix.Itdoesnotverifythatthec:fnamefunctionexists,nordoesitverifythecorrectnessoftheotherargumentssupplied.

Examples

ThefollowingexampleillustratestheuseofsetfunhelpbydefiningasimplefunctionandissuingsetfunhelptoassociatethefunctionwiththecircletopicintheAutoCADHelpfile(acad.chm):

(defunc:foo()

(getstring"PressF1forhelponthefoocommand:")

)

(setfunhelp"c:foo""acad.chm""circle")

Afterthiscodeisloaded,issuingthefoocommandandthenpressingF1displaysthecircletopic.

Thisexampleworks,butservesnorealpurpose.Intherealworld,youwouldcreateyourownHelpfileandassociatethatHelpfileandtopicwithyourfunction.

Defineafunctionnamedtest:Command:(defunc:test()(getstring"\nTEST:")(princ))

C:TEST

AssociatethefunctionwithacalltoHelpwiththestring“line”:Command:(setfunhelp"c:test""acad.chm""line")

"c:test"

Runthetestcommandandattheprompt,pressF1;youshouldseetheHelptopicfortheAutoCADLINEcommand.

Note WhenyouusethedefunfunctiontodefineaC:XXXfunction,itremoves

Page 362: less than or equalAutoLISP Functions

thatfunction'snamefromthoseregisteredbysetfunhelp(ifoneexists).Therefore,setfunhelpshouldbecalledonlyafterthedefuncall,whichdefinestheuser-definedcommand.

SeeAlsoThedefunandhelpfunctions.

Pleasesendusyourcommentaboutthispage

Page 363: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setq

Setsthevalueofasymbolorsymbolstoassociatedexpressions

(setqsymexpr[symexpr]...)

ThisisthebasicassignmentfunctioninAutoLISP.Thesetqfunctioncanassignmultiplesymbolsinonecalltothefunction.

Arguments

sym

Asymbol.Thisargumentisnotevaluated.

expr

Anexpression.

ReturnValues

Theresultofthelastexprevaluated.

Examples

Thefollowingfunctioncallsetsvariableato5.0:Command:(setqa5.0)

5.0

Wheneveraisevaluated,itreturnstherealnumber5.0.

Thefollowingcommandsetstwovariables,bandc:Command:(setqb123c4.7)

4.7

setqreturnsthevalueofthelastvariableset.

Inthefollowingexample,sissettoastring:

Page 364: less than or equalAutoLISP Functions

Command:(setqs"it")

"it"

Thefollowingexampleassignsalisttox:Command:(setqx'(ab))

(AB)

SeeAlsoTheAutoLISPVariablestopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 365: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setvar

SetsanAutoCADsystemvariabletoaspecifiedvalue

(setvarvarnamevalue)

Arguments

varname

Astringorsymbolnamingavariable.

value

Anatomorexpressionwhoseevaluatedresultistobeassignedtovarname.Forsystemvariableswithintegervalues,thesuppliedvaluemustbebetween-32,768and+32,767.

ReturnValues

Ifsuccessful,setvarreturnsvalue.

Examples

SettheAutoCADfilletradiusto0.5units:Command:(setvar"FILLETRAD"0.50)

0.5

NotesonUsingsetvar

SomeAutoCADcommandsobtainthevaluesofsystemvariablesbeforeissuinganyprompts.Ifyouusesetvartosetanewvaluewhileacommandisinprogress,thenewvaluemightnottakeeffectuntilthenextAutoCADcommand.

WhenusingthesetvarfunctiontochangetheAutoCADsystemvariableANGBASE,thevalueargumentisinterpretedasradians.ThisdiffersfromtheAutoCADSETVARcommandintheCommandReference,whichinterpretsthis

Page 366: less than or equalAutoLISP Functions

argumentasdegrees.WhenusingthesetvarfunctiontochangetheAutoCADsystemvariableSNAPANG,thevalueargumentisinterpretedasradiansrelativetotheAutoCADdefaultdirectionforangle0,whichiseastor3o'clock.ThisalsodiffersfromtheSETVARcommand,whichinterpretsthisargumentasdegreesrelativetotheANGBASEsetting.

Note TheUNDOcommanddoesnotundochangesmadetotheCVPORTsystemvariablebythesetvarfunction.

YoucanfindalistofthecurrentAutoCADsystemvariablesintheCommandReference.

SeeAlsoThegetvarfunction.

Pleasesendusyourcommentaboutthispage

Page 367: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

setview

Establishesaviewforaspecifiedviewport

(setviewview_descriptor[vport_id])

Arguments

view_descriptor

AnentitydefinitionlistsimilartothatreturnedbytblsearchwhenappliedtotheVIEWsymboltable.

vport_id

Anintegeridentifyingtheviewporttoreceivethenewview.Ifvport_idis0,thecurrentviewportreceivesthenewview.Youcanobtainthevport_idnumberfromtheCVPORTsystemvariable.

ReturnValues

Ifsuccessful,thesetviewfunctionreturnstheview_descriptor.

Pleasesendusyourcommentaboutthispage

Page 368: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

sin

Returnsthesineofanangleasarealnumberexpressedinradians

(sinang)

Arguments

ang

Anangle,inradians.

ReturnValues

Arealnumberrepresentingthesineofang,inradians.

ExamplesCommand:(sin1.0)

0.841471

Command:(sin0.0)

0.0

Pleasesendusyourcommentaboutthispage

Page 369: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

slide_image

DisplaysanAutoCADslideinthecurrentlyactivedialogboximagetile

(slide_imagex1y1widthheightsldname)

Arguments

x1

X-offsetfromtheupper-leftcornerofthetile,inpixels.Mustbeapositivevalue.

y1

Y-offsetfromtheupper-leftcornerofthetile,inpixels.Mustbeapositivevalue.

width

Widthoftheimage,inpixels.

height

Heightoftheimage,inpixels.

sldname

Identifiestheslide.Thisargumentcanbeaslidefile(.sld)oraslideinaslidelibraryfile(.slb).SpecifysldnamethesamewayyouwouldspecifyitfortheVSLIDEcommandorforamenufile(seetheCreatingImagestopicintheAutoLISPDeveloper'sGuide).Useoneofthefollowingformatsforsldname:sldnameorlibname(sldname)

Thefirst(upper-left)corneroftheslide—itsinsertionpoint—islocatedat(x1,y1),andthesecond(lower-right)cornerislocatedattherelativedistance

Page 370: less than or equalAutoLISP Functions

(wid,hgt)fromthefirst(widandhgtmustbepositivevalues).Theorigin(0,0)istheupper-leftcorneroftheimage.Youobtainthecoordinatesofthelower-rightcornerbycallingthedimensionfunctions(dimx_tileanddimy_tile).

ReturnValues

Astringcontainingsldname.

Examples

(slide_image

0

0

(dimx_tile"slide_tile")

(dimy_tile"slide_tile")

"myslide"

)

(end_image)

Pleasesendusyourcommentaboutthispage

Page 371: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

snvalid

Checksthesymboltablenameforvalidcharacters

(snvalidsym_name[flag])

ThesnvalidfunctioninspectsthesystemvariableEXTNAMEStodeterminetherulestoenforcefortheactivedrawing.IfEXTNAMESis0,snvalidvalidatesusingthesymbolnamerulesineffectpriortoAutoCAD2000.IfEXTNAMESis1(thedefaultvalue),snvalidvalidatesusingtherulesforextendedsymbolnamesintroducedwithAutoCAD2000.Thefollowingarenotallowedinsymbolnames,regardlessofthesettingofEXTNAMES:

Controlandgraphiccharacters

Nullstrings

Verticalbarsasthefirstorlastcharacterofthename

AutoLISPdoesnotenforcerestrictionsonthelengthofsymboltablenamesifEXTNAMESis1.

Arguments

sym_name

Astringthatspecifiesasymboltablename.

flag

Anintegerthatspecifieswhethertheverticalbarcharacterisallowedwithinsym_name.Theflagargumentcanbeoneofthefollowing:0 Donotallowverticalbarcharactersanywhereinsym_name.Thisisthedefault.1 Allowverticalbarcharactersinsym_name,aslongastheyarenotthefirstorlastcharactersinthename.

Page 372: less than or equalAutoLISP Functions

ReturnValues

T,ifsym_nameisavalidsymboltablename;otherwisenil.

IfEXTNAMESis1,allcharactersareallowedexceptcontrolandgraphiccharactersandthefollowing:

Charactersdisallowedinsymboltablenames

<> less-thanandgreater-thansymbol

/\ forwardslashandbackslash

" quotationmark

: colon

? questionmark

* asterisk

| verticalbar

, comma

= equalsign

` backquote

; semicolon(ASCII59)

Asymboltablenamemaycontainspaces.

IfEXTNAMESis0,symboltablenamescanconsistofuppercaseandlowercasealphabeticletters(e.g.,A-Z),numericdigits(e.g.,0-9),andthedollarsign($),underscore(_),andhyphen(-)characters.

Examples

Page 373: less than or equalAutoLISP Functions

ThefollowingexamplesassumeEXTNAMESissetto1:Command:(snvalid"hocus-pocus")

T

Command:(snvalid"hocuspocus")

T

Command:(snvalid"hocus%pocus")

T

ThefollowingexamplesassumeEXTNAMESissetto0:Command:(snvalid"hocus-pocus")

T

Command:(snvalid"hocuspocus")

nil

Command:(snvalid"hocus%pocus")

nil

Thefollowingexampleincludesaverticalbarinthesymboltablename:Command:(snvalid"hocus|pocus")

nil

Bydefault,theverticalbarcharacterisconsideredinvalidinallsymboltablenames.

Inthefollowingexample,theflagargumentissetto1,sosnvalidconsiderstheverticalbarcharactertobevalidinsym_name,aslongasitisnotthefirstorlastcharacterinthename:

Command:(snvalid"hocus|pocus"1)

T

Pleasesendusyourcommentaboutthispage

Page 374: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

sqrt

Returnsthesquarerootofanumberasarealnumber

(sqrtnum)

Arguments

num

Anumber(integerorreal).

ReturnValues

Arealnumber.

ExamplesCommand:(sqrt4)

2.0

Command:(sqrt2.0)

1.41421

Pleasesendusyourcommentaboutthispage

Page 375: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssadd

Addsanobject(entity)toaselectionset,orcreatesanewselectionset

(ssadd[ename[ss]])

Arguments

ename

Anentityname.

ss

Aselectionset.

Ifcalledwithnoarguments,ssaddconstructsanewselectionsetwithnomembers.Ifcalledwiththesingleentitynameargumentename,ssaddconstructsanewselectionsetcontainingthatsingleentity.Ifcalledwithanentitynameandtheselectionsetss,ssaddaddsthenamedentitytotheselectionset.

ReturnValues

Themodifiedselectionsetpassedasthesecondargument,ifsuccessful;otherwisenil.

Examples

Whenaddinganentitytoaset,thenewentityisaddedtotheexistingset,andthesetpassedasssisreturnedastheresult.Thus,ifthesetisassignedtoothervariables,theyalsoreflecttheaddition.Ifthenamedentityisalreadyintheset,thessaddoperationisignoredandnoerrorisreported.

Sete1tothenameofthefirstentityindrawing:Command:(setqe1(entnext))

Page 376: less than or equalAutoLISP Functions

<Entityname:1d62d60>

Setsstoanullselectionset:Command:(setqss(ssadd))

<Selectionset:2>

Thefollowingcommandaddsthee1entitytotheselectionsetreferencedbyss:

Command:(ssadde1ss)

<Selectionset:2>

Gettheentityfollowinge1:Command:(setqe2(entnexte1))

<Entityname:1d62d68>

Adde2tothessentity:Command:(ssadde2ss)

<Selectionset:2>

Pleasesendusyourcommentaboutthispage

Page 377: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssdel

Deletesanobject(entity)fromaselectionset

(ssdelenamess)

Arguments

ename

Anentityname.

ss

Aselectionset.

ReturnValues

Thenameoftheselectionset;otherwisenil,ifthespecifiedentityisnotintheset.

Notethattheentityisactuallydeletedfromtheexistingselectionset,asopposedtoanewsetbeingreturnedwiththeelementdeleted.

Examples

Inthefollowingexamples,entitynamee1isamemberofselectionsetss,whileentitynamee3isnotamemberofss:

Command:(ssdele1ss)

<Selectionset:2>

Selectionsetssisreturnedwithentitye1removed.Command:(ssdele3ss)

nil

Thefunctionreturnsnilbecausee3isnotamemberofselectionsetss.

Page 378: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 379: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssget

Createsaselectionsetfromtheselectedobject

(ssget[sel-method][pt1[pt2]]

[pt-list][filter-list])

Selectionsetscancontainobjectsfrombothpaperandmodelspace,butwhentheselectionsetisusedinanoperation,ssgetfiltersoutobjectsfromthespacenotcurrentlyineffect.Selectionsetsreturnedbyssgetcontainmainentitiesonly(noattributesorpolylinevertices).

Arguments

sel-method

Astringthatspecifiestheobjectselectionmethod.ValidselectionmethodsareC Crossingselection.CP Cpolygonselection(allobjectscrossingandinsideofthespecifiedpolygon).F Fenceselection.I Impliedselection(objectsselectedwhilePICKFIRSTisineffect).L Lastvisibleobjectaddedtothedatabase.P Lastselectionsetcreated.W Windowselection.WP WPolygon(allobjectswithinthespecifiedpolygon).X Entiredatabase.IfyouspecifytheXselectionmethodanddonotprovideafilter-list,ssgetselectsallentitiesinthedatabase,includingentitiesonlayersthatareoff,frozen,andoutofthevisiblescreen.:E Everythingwithinthecursor'sobjectselectionpickbox.:N Callssnamexforadditionalinformationoncontainerblocksand

Page 380: less than or equalAutoLISP Functions

transformationmatricesforanyentitiesselectedduringthessgetoperation.ThisadditionalinformationisavailableonlyforentitiesselectedviagraphicalselectionmethodssuchasWindow,Crossing,andpointpicks.Unliketheotherobjectselectionmethods,:Nmayreturnmultipleentitieswiththesameentitynameintheselectionset.Forexample,iftheuserselectsasubentityofacomplexentitysuchasaBlockReference,PolygonMesh,oroldstylepolyline,ssgetlooksatthesubentitythatisselectedwhendeterminingifithasalreadybeenselected.However,ssgetactuallyaddsthemainentity(BlockReference,PolygonMesh,andsoon)totheselectionset.Theresultcouldbemultipleentrieswiththesameentitynameintheselectionset(eachwillhavedifferentsubentityinformationforssnamextoreport).:S Allowsingleselectiononly.:U Enablessubentityselection.Cannotbecombinedwiththeduplicate(":D")ornested(":N")selectionmodes.Inthismode,top-levelentitiesareselectedbydefault,buttheusercanattempttoselectsubentitiesbypressingtheCTRLkeywhilemakingtheselection.Thisoptionissupportedonlywithinteractiveselections,suchaswindow,crossing,andpolygon.Itisnotsupportedforall,filtered,orgroupselections.:V Forcessubentityselection.Treatsallinteractive,graphicselectionsperformedbytheuserassubentityselections.Thereturnedselectionsetcontainssubentitiesonly.Thisoptioncannotbecombinedwiththeduplicate(":D")ornested(":N")selectionmodes.Thisoptionissupportedonlywithinteractiveselections,suchaswindowandcrossing.Itisnotsupportedforall,filtered,orgroupselections.

pt1

Apointrelativetotheselection.

pt2

Apointrelativetotheselection.

pt-list

Alistofpoints.

filter-list

Anassociationlistthatspecifiesobjectproperties.Objectsthatmatchthe

Page 381: less than or equalAutoLISP Functions

filter-listareaddedtotheselectionset.

Ifyouomitallarguments,ssgetpromptstheuserwiththeSelectObjectsprompt,allowinginteractiveconstructionofaselectionset.

Ifyousupplyapointbutdonotspecifyanobjectselectionmethod,AutoCADassumestheuserisselectinganobjectbypickingasinglepoint.

ReturnValues

Thenameofthecreatedselectionsetifsuccessful;otherwisenilifnoobjectswereselected.

NotesontheObjectSelectionMethods

Whenusingthe:Nselectionmethod,iftheuserselectsasubentityofacomplexentitysuchasaBlockReference,PolygonMesh,oroldstylepolyline,ssgetlooksatthesubentitythatisselectedwhendeterminingifithasalreadybeenselected.However,ssgetactuallyaddsthemainentity(BlockReference,PolygonMesh,etc.)totheselectionset.Itisthereforepossibletohavemultipleentrieswiththesameentitynameintheselectionset(eachwillhavedifferentsubentityinformationforssnamextoreport).Becausethe:Nmethoddoesnotguaranteethateachentrywillbeunique,codethatreliesonuniquenessshouldnotuseselectionsetscreatedusingthisoption.

WhenusingtheLselectionmethodinanMDIenvironment,youcannotalwayscountonthelastobjectdrawntoremainvisible.Forexample,ifyourapplicationdrawsaline,andtheusersubsequentlyminimizesorcascadestheAutoCADdrawingwindow,thelinemaynolongerbevisible.Ifthisoccurs,ssgetwiththe"L"optionwillreturnnil.

Examples

Prompttheusertoselecttheobjectstobeplacedinaselectionset:Command:(ssget)

<Selectionset:2>

Createaselectionsetoftheobjectpassingthrough(2,2):Command:(ssget'(22))

nil

Page 382: less than or equalAutoLISP Functions

Createaselectionsetofthemostrecentlyselectedobjects:Command:(ssget"_P")

<Selectionset:4>

Createaselectionsetoftheobjectscrossingtheboxfrom(0,0)to(1,1):Command:(ssget"_C"'(00)'(11))

<Selectionset:b>

Createaselectionsetoftheobjectsinsidethewindowfrom(0,0):Command:(ssget"_W"'(00)'(55))

<Selectionset:d>

Byspecifyingfilters,youcanobtainaselectionsetthatincludesallobjectsofagiventype,onagivenlayer,orofagivencolor.Thefollowingexamplereturnsaselectionsetthatconsistsonlyofbluelinesthatarepartoftheimpliedselectionset(thoseobjectsselectedwhilePICKFIRSTisineffect):

Command:(ssget"_I"'((0."LINE")(62.5)))

<Selectionset:4>

Thefollowingexamplesofssgetrequirethatalistofpointsbepassedtothefunction.Thept_listvariablecannotcontainpointsthatdefinezero-lengthsegments.

Createalistofpoints:Command:(setqpt_list'((11)(31)(52)(24)))

((11)(31)(52)(24))

Createaselectionsetofallobjectscrossingandinsidethepolygondefinedbypt_list:

Command:(ssget"_CP"pt_list)

<Selectionset:13>

Createaselectionsetofallbluelinesinsidethepolygondefinedbypt_list:Command:(ssget"_WP"pt_list'((0."LINE")(62.5)))

<Selectionset:8>

Theselectedobjectsarehighlightedonlywhenssgetisusedwithnoarguments.SelectionsetsconsumeAutoCADtemporaryfileslots,soAutoLISPisnotpermittedtohavemorethan128openatonetime.Ifthislimitisreached,AutoCADcannotcreateanymoreselectionsetsandreturnsniltoallssgetcalls.Tocloseanunnecessaryselectionsetvariable,setittonil.

Page 383: less than or equalAutoLISP Functions

AselectionsetvariablecanbepassedtoAutoCADinresponsetoanySelectobjectspromptatwhichselectionbyLastisvalid.AutoCADthenselectsalltheobjectsintheselectionsetvariable.

ThecurrentsettingofObjectSnapmodeisignoredbyssgetunlessyouspecificallyrequestitwhileyouareinthefunction.

SeeAlsoSelectionSetHandlingandSelectionSetFilterListsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 384: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssgetfirst

Determineswhichobjectsareselectedandgripped

(ssgetfirst)

Returnsalistoftwoselectionsetssimilartothosepassedtosssetfirst.ThefirstelementinthelistisalwaysnilbecauseAutoCADnolongersupportsgripsonunselectedobjects.Thesecondelementisaselectionsetofentitiesthatareselectedandgripped.Bothelementsofthelistcanbenil.

Note Onlyentitiesfromthecurrentdrawing'smodelspaceandpaperspace,notnongraphicalobjectsorentitiesinotherblockdefinitions,canbeanalyzedbythisfunction.

SeeAlsoThessgetandsssetfirstfunctions.

Pleasesendusyourcommentaboutthispage

Page 385: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

sslength

Returnsanintegercontainingthenumberofobjects(entities)inaselectionset

(sslengthss)

Arguments

ss

Aselectionset.

ReturnValues

Aninteger.

Examples

Addthelastobjecttoanewselectionset:Command:(setqsset(ssget"L"))

<Selectionset:8>

Usesslengthtodeterminethenumberofobjectsinthenewselectionset:Command:(sslengthsset)

1

Pleasesendusyourcommentaboutthispage

Page 386: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssmemb

Testswhetheranobject(entity)isamemberofaselectionset

(ssmembenamess)

Arguments

ename

Anentityname.

ss

Aselectionset.

ReturnValues

Ifenameisamemberofss,ssmembreturnstheentityname.Ifenameisnotamember,ssmembreturnsnil.

Examples

Inthefollowingexamples,entitynamee2isamemberofselectionsetss,whileentitynamee1isnotamemberofss:

Command:(ssmembe2ss)

<Entityname:1d62d68>

Command:(ssmembe1ss)

nil

Pleasesendusyourcommentaboutthispage

Page 387: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssname

Returnstheobject(entity)nameoftheindexedelementofaselectionset

(ssnamessindex)

Entitynamesinselectionsetsobtainedwithssgetarealwaysnamesofmainentities.Subentities(attributesandpolylinevertices)arenotreturned.(Theentnextfunctionallowsaccesstothem.)

Arguments

ss

Aselectionset.

index

Aninteger(orreal)indicatinganelementinaselectionset.Thefirstelementinthesethasanindexofzero.Toaccessentitiesbeyondnumber32,767inaselectionset,youmustsupplytheindexargumentasareal.

ReturnValues

Anentityname,ifsuccessful.Ifindexisnegativeorgreaterthanthehighest-numberedentityintheselectionset,ssnamereturnsnil.

Examples

Getthenameofthefirstentityinaselectionset:Command:(setqent1(ssnamess0))

<Entityname:1d62d68>

Getthenameofthefourthentityinaselectionset:Command:(setqent4(ssnamess3))

<Entityname:1d62d90>

Page 388: less than or equalAutoLISP Functions

Toaccessentitiesbeyondthenumber32,767inaselectionset,youmustsupplytheindexargumentasareal,asinthefollowingexample:

(setqentx(ssnamesset50843.0))

SeeAlsoTheentnextfunction.

Pleasesendusyourcommentaboutthispage

Page 389: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

ssnamex

Retrievesinformationabouthowaselectionsetwascreated

(ssnamexss[index])

Onlyselectionsetswithentitiesfromthecurrentdrawing'smodelspaceandpaperspace—notnongraphicalobjectsorentitiesinotherblockdefinitions—canberetrievedbythisfunction.

Arguments

ss

Aselectionset.

index

Aninteger(orreal)indicatinganelementinaselectionset.Thefirstelementinthesethasanindexofzero.

ReturnValues

Ifsuccessful,ssnamexreturnsthenameoftheentityatindex,alongwithdatadescribinghowtheentitywasselected.Iftheindexargumentisnotsupplied,thisfunctionreturnsalistcontainingtheentitynamesoftheelementsintheselectionset,alongwithdatathatdescribeshoweachentitywasselected.Ifindexisnegativeorgreaterthanthehighest-numberedentityintheselectionset,ssnamexreturnsnil.

Thedatareturnedbyssnamextakestheformofalistoflistscontaininginformationthatdescribeseitheranentityanditsselectionmethodorapolygonusedtoselectoneormoreentities.Eachsublistthatdescribestheselectionofaparticularentitycomprisesthreeparts:theselectionmethodID(aninteger>=0),theentitynameoftheselectedentity,andselectionmethodspecificdatathatdescribeshowtheentitywasselected.

Page 390: less than or equalAutoLISP Functions

((sel_id1ename1(data))(sel_id2ename2(data))...)

ThefollowingtableliststheselectionmethodIDs:

SelectionmethodIDs

ID Description

0 Nonspecific(i.e.,LastAll)

1 Pick

2 WindoworWPolygon

3 CrossingorCPolygon

4 Fence

EachsublistthatbothdescribesapolygonandisusedduringentityselectiontakestheformofapolygonID(aninteger<0),followedbypointdescriptions.

(polygon_idpoint_description_1point_description_n...)

PolygonIDnumberingstartsat-1andeachadditionalpolygonIDisincrementedby-1.Dependingontheviewinglocation,apointisrepresentedasoneofthefollowing:aninfiniteline,aray,oralinesegment.Apointdescriptorcomprisesthreeparts:apointdescriptorID(thetypeofitembeingdescribed),thestartpointoftheitem,andanoptionalunitvectorthatdescribeseitherthedirectioninwhichtheinfinitelinetravelsoravectorthatdescribestheoffsettotheothersideofthelinesegment.

(point_descriptor_idbase_point[unit_or_offset_vector])

ThefollowingtableliststhevalidpointdescriptorIDs:

PointdescriptorIDs

Page 391: less than or equalAutoLISP Functions

ID Description

0 Infiniteline

1 Ray

2 Linesegment

Theunit_or_offset_vectorisreturnedwhentheviewpointissomethingotherthan0,0,1.

Examples

ThedataassociatedwithPick(type1)entityselectionsisasinglepointdescription.Forexample,thefollowingrecordisreturnedfortheselectionofanentitypickedat1,1inplanviewoftheWCS:

Command:(ssnamexss30)

((1<Entityname:1d62da0>0(0(1.01.00.0))))

ThedataassociatedwithanentityselectedwiththeWindow,WPolygon,Crossing,orCPolygonmethodistheintegerIDofthepolygonthatselectedtheentity.Itisuptotheapplicationtoassociatethepolygonidentifiersandmaketheconnectionbetweenthepolygonandtheentitiesitselected.Forexample,thefollowingreturnsanentityselectedbyCrossing(notethatthepolygonIDis-1):

Command:(ssnamexss40)

((3<Entityname:1d62d60>0-1)(-1(0(-1.808798.855360.0))(0(13.40048.855360.0))(0(13.40041.800240.0))(0(-1.808791.800240.0))))

Thedataassociatedwithfenceselectionsisalistofpointsanddescriptionsforthepointswherethefenceandentityvisuallyintersect.Forexample,thefollowingcommandreturnsinformationforanearlyverticallineintersectedthreetimesbyaZ-shapedfence:

Command:(ssnamexss50)

((4<Entityname:1d62d88>0(0(5.281356.252190.0))(0(5.618682.819610.0))(0(5.526883.753810.0))))

Pleasesendusyourcommentaboutthispage

Page 392: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

sssetfirst

Setswhichobjectsareselectedandgripped

(sssetfirstgripset[pickset])

Thegripsetargumentisignored;theselectionsetofobjectsspecifiedbypicksetareselectedandgripped.

Youareresponsibleforcreatingavalidselectionset.Forexample,youmayneedtoverifythatabackgroundpaperspaceviewport(DXFgroupcode69)isnotincludedintheselectionset.Youmayalsoneedtoensurethatselectedobjectsbelongtothecurrentlayout,asinthefollowingcode:

(setqss(ssget(list(cons410(getvar"ctab")))))

Arguments

gripset

AutoCADnolongersupportsgripsonunselectedobjects,sothisargumentisignored.However,ifgripsetisnilandnopicksetisspecified,sssetfirstturnsoffthegriphandlesandselectionsitpreviouslyturnedon.

pickset

Aselectionsettobeselected.

ReturnValues

Theselectionsetorsetsspecified.

Examples

First,drawasquareandbuildthreeselectionsets.Beginbydrawingside1andcreatingaselectionsettoincludethelinedrawn:

Page 393: less than or equalAutoLISP Functions

Command:(entmake(list(cons0"line")'(100.00.00.0)'(110.010.00.0)))

((0."line")(100.00.00.0)(110.010.00.0))

Command:(setqpickset1(ssget"_l"))

<Selectionset:a5>

Variablepickset1pointstotheselectionsetcreated.

Drawside2andaddittothepickset1selectionset:Command:(entmake(list(cons0"line")'(100.010.00.0)'(1110.010.00.0)))

((0."line")(100.010.00.0)(1110.010.00.0))

Command:(ssadd(entlast)pickset1)

<Selectionset:a5>

Createanotherselectionsettoincludeonlyside2:Command:(setq2onlyset(ssget"_l"))

<Selectionset:a8>

Drawside3andaddittothepickset1selectionset:Command:(entmake(list(cons0"line")'(1010.010.00.0)'(1110.00.00.0)))

((0."line")(1010.010.00.0)(1110.00.00.0))

Command:(ssadd(entlast)pickset1)

<Selectionset:a5>

Createanotherselectionandincludeside3intheselectionset:Command:(setqpickset2(ssget"_l"))

<Selectionset:ab>

Variablepickset2pointstothenewselectionset.

Drawside4andaddittothepickset1andpickset2selectionsets:Command:(entmake(list(cons0"line")'(1010.00.00.0)'(110.00.00.0)))

((0."line")(1010.00.00.0)(110.00.00.0))

Command:(ssadd(entlast)pickset1)

<Selectionset:a5>

Command:(ssadd(entlast)pickset2)

<Selectionset:ab>

Atthispoint,pickset1containssides1-4,pickset2containssides3and4,and2onlysetcontainsonlyside2.

Turngriphandlesonandselectallobjectsinpickset1:

Page 394: less than or equalAutoLISP Functions

Command:(sssetfirstnilpickset1)

(nil<Selectionset:a5>)

Turngriphandlesonandselectallobjectsinpickset2:Command:(sssetfirstnilpickset2)

(nil<Selectionset:ab>)

Turngriphandlesonandselectallobjectsin2onlyset:Command:(sssetfirstnil2onlyset)

(nil<Selectionset:a8>)

Eachsssetfirstcallreplacesthegrippedandselectedselectionsetfromtheprevioussssetfirstcall.

Note DonotcallsssetfirstwhenAutoCADisinthemiddleofexecutingacommand.

SeeAlsoThessgetandssgetfirstfunctions.

Pleasesendusyourcommentaboutthispage

Page 395: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

startapp

StartsaWindowsapplication

(startappappcmd[file])

Arguments

appcmd

Astringthatspecifiestheapplicationtoexecute.Ifappcmddoesnotincludeafullpathname,startappsearchesthedirectoriesinthePATHenvironmentvariablefortheapplication.

file

Astringthatspecifiesthefilenametobeopened.

ReturnValues

Anintegergreaterthan0,ifsuccessful;otherwisenil.

Examples

ThefollowingcodestartsWindowsNotepadandopenstheacad.lspfile.Command:(startapp"notepad""acad.lsp")

33

Ifanargumenthasembeddedspaces,itmustbesurroundedbyliteraldoublequotes.Forexample,toeditthefilemystuff.txtwithNotepad,usethefollowingsyntax:

Command:(startapp"notepad.exe""\"mystuff.txt\"")

33

Pleasesendusyourcommentaboutthispage

Page 396: less than or equalAutoLISP Functions
Page 397: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

start_dialog

Displaysadialogboxandbeginsacceptinguserinput

(start_dialog)

Youmustfirstinitializethedialogboxbyapreviousnew_dialogcall.Thedialogboxremainsactiveuntilanactionexpressionorcallbackfunctioncallsdone_dialog.Usuallydone_dialogisassociatedwiththetilewhosekeyis"accept"(typicallytheOKbutton)andthetilewhosekeyis"cancel"(typicallytheCancelbutton).

Thestart_dialogfunctionhasnoarguments.

ReturnValues

Thestart_dialogfunctionreturnstheoptionalstatuspassedtodone_dialog.Thedefaultvalueis1iftheuserpressesOK,0iftheuserpressesCancel,or-1ifalldialogboxesareterminatedwithterm_dialog.Ifdone_dialogispassedanintegerstatusgreaterthan1,start_dialogreturnsthisvalue,whosemeaningisdeterminedbytheapplication.

Pleasesendusyourcommentaboutthispage

Page 398: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

start_image

Startsthecreationofanimageinthedialogboxtile

(start_imagekey)

Subsequentcallstofill_image,slide_image,andvector_imageaffectthecreatedimageuntiltheapplicationcallsend_image.

Arguments

key

Astringthatspecifiesthedialogboxtile.Thekeyargumentiscase-sensitive.

ReturnValues

Thekeyargument,ifsuccessful;otherwisenil.

Note Donotusetheset_tilefunctionbetweenstart_imageandend_imagefunctioncalls.

Pleasesendusyourcommentaboutthispage

Page 399: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

start_list

Startstheprocessingofalistinthelistboxorinthepop-uplistdialogboxtile

(start_listkey[operation[index]])

Subsequentcallstoadd_listaffecttheliststartedbystart_listuntiltheapplicationcallsend_list.

Arguments

key

Astringthatspecifiesthedialogboxtile.Thekeyargumentiscase-sensitive.

operation

Anintegerindicatingthetypeoflistoperationtoperform.Youcanspecifyoneofthefollowing:1 Changeselectedlistcontents2 Appendnewlistentry3 Deleteoldlistandcreatenewlist(thedefault)

index

Anumberindicatingthelistitemtochangebythesubsequentadd_listcall.Thefirstiteminthelistisindex0.Ifnotspecified,indexdefaultsto0.Theindexargumentisignoredifstart_listisnotperformingachangeoperation.

ReturnValues

Thenameofthelistthatwasstarted.

Note Donotusetheset_tilefunctionbetweenstart_listandend_listfunctioncalls.

Page 400: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 401: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

strcase

Returnsastringwhereallalphabeticcharactershavebeenconvertedtouppercaseorlowercase

(strcasestring[which])

Arguments

string

Astring.

which

IfspecifiedasT,allalphabeticcharactersinstringareconvertedtolowercase.Otherwise,charactersareconvertedtouppercase.

ReturnValues

Astring.

ExamplesCommand:(strcase"Sample")

"SAMPLE"

Command:(strcase"Sample"T)

"sample"

Thestrcasefunctionwillcorrectlyhandlecasemappingofthecurrentlyconfiguredcharacterset.

Pleasesendusyourcommentaboutthispage

Page 402: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

strcat

Returnsastringthatistheconcatenationofmultiplestrings

(strcat[string[string]...])

Arguments

string

Astring.

ReturnValues

Astring.Ifnoargumentsaresupplied,strcatreturnsazero-lengthstring.

ExamplesCommand:(strcat"a""bout")

"about"

Command:(strcat"a""b""c")

"abc"

Command:(strcat"a""""c")

"ac"

Command:(strcat)

""

Pleasesendusyourcommentaboutthispage

Page 403: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

strlen

Returnsanintegerthatisthenumberofcharactersinastring

(strlen[string]...)

Arguments

string

Astring.

ReturnValues

Aninteger.Ifmultiplestringargumentsareprovided,strlenreturnsthesumofthelengthsofallarguments.Ifyouomittheargumentsorenteranemptystring,strlenreturns0.

ExamplesCommand:(strlen"abcd")

4

Command:(strlen"ab")

2

Command:(strlen"one""two""four")

10

Command:(strlen)

0

Command:(strlen"")

0

Pleasesendusyourcommentaboutthispage

Page 404: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

subst

Searchesalistforanolditemandreturnsacopyofthelistwithanewitemsubstitutedinplaceofeveryoccurrenceoftheolditem

(substnewitemolditemlst)

Arguments

newitem

Anatomorlist.

olditem

Anatomorlist.

lst

Alist.

ReturnValues

Alist,withnewitemreplacingalloccurrencesofolditem.Ifolditemisnotfoundinlst,substreturnslstunchanged.

ExamplesCommand:(setqsample'(ab(cd)b))

(AB(CD)B)

Command:(subst'qq'bsample)

(AQQ(CD)QQ)

Command:(subst'qq'zsample)

(AB(CD)B)

Command:(subst'qq'(cd)sample)

(ABQQB)

Command:(subst'(qqrr)'(cd)sample)

Page 405: less than or equalAutoLISP Functions

(AB(QQRR)B)

Command:(subst'(qqrr)'zsample)

(AB(CD)B)

Whenusedinconjunctionwithassoc,substprovidesaconvenientmeansofreplacingthevalueassociatedwithonekeyinanassociationlist,asdemonstratedbythefollowingfunctioncalls.

Setvariablewhotoanassociationlist:Command:(setqwho'((firstjohn)(midq)(lastpublic)))

((FIRSTJOHN)(MIDQ)(LASTPUBLIC))

Thefollowingsetsoldto(FIRSTJOHN)andnewto(FIRSTJ):Command:(setqold(assoc'firstwho)new'(firstj))

(FIRSTJ)

Finally,replacethevalueofthefirstitemintheassociationlist:Command:(substnewoldwho)

((FIRSTJ)(MIDQ)(LASTPUBLIC))

Pleasesendusyourcommentaboutthispage

Page 406: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>SFunctions>

substr

Returnsasubstringofastring

(substrstringstart[length])

Thesubstrfunctionstartsatthestartcharacterpositionofstringandcontinuesforlengthcharacters.

Arguments

string

Astring.

start

Apositiveintegerindicatingthestartingpositioninstring.Thefirstcharacterinthestringisposition1.

length

Apositiveintegerspecifyingthenumberofcharacterstosearchthroughinstring.Iflengthisnotspecified,thesubstringcontinuestotheendofstring.

Note Thefirstcharacterofstringischaracternumber1.Thisdiffersfromotherfunctionsthatprocesselementsofalist(likenthandssname)thatcountthefirstelementas0.

ReturnValues

Astring.

ExamplesCommand:(substr"abcde"2)

"bcde"

Command:(substr"abcde"21)

Page 407: less than or equalAutoLISP Functions

"b"

Command:(substr"abcde"32)

"cd"

Pleasesendusyourcommentaboutthispage

Page 408: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

TFunctions

tabletRetrievesandsetsdigitizer(tablet)calibrationstblnextFindsthenextiteminasymboltabletblobjnameReturnstheentitynameofaspecifiedsymboltableentrytblsearchSearchesasymboltableforasymbolnameterm_dialogTerminatesallcurrentdialogboxesasiftheuserhadcanceledeachofthemterpriPrintsanewlinetothecommandlinetextboxMeasuresaspecifiedtextobject,andreturnsthediagonalcoordinatesofaboxthatenclosesthetexttextpageSwitchesfocusfromthedrawingareatothetextscreentextscrSwitchesfocusfromthedrawingareatothetextscreen(liketheAutoCADF2functionkey)traceAidsinAutoLISPdebugging

Page 409: less than or equalAutoLISP Functions

transTranslatesapoint(oradisplacement)fromonecoordinatesystemtoanothertypeReturnsthetypeofaspecifieditem

Pleasesendusyourcommentaboutthispage

Page 410: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

tablet

Retrievesandsetsdigitizer(tablet)calibrations

(tabletcode[row1row2row3direction])

Arguments

code

Anintegerthatcanbeoneofthefollowing:0 Returnthecurrentdigitizercalibration.Inthiscase,theremainingargumentsmustbeomitted.1 Setthecalibrationaccordingtotheargumentsthatfollow.Inthiscase,youmustprovidethenewcalibrationsettings(row1,row2,row3,anddirection).

row1,row2,row3

Three3Dpoints.Thesethreeargumentsspecifythethreerowsofthetablet'stransformationmatrix.Thethirdelementinrow3(Z)shouldalwaysequal1:tabletreturnsitas1evenifyouspecifyadifferentvalueinrow3.

direction

One3Dpoint.Thisisthevector(expressedintheworldcoordinatesystem,orWCS)thatisnormaltotheplanethatrepresentsthesurfaceofthetablet.Ifthespecifieddirectionisn'tnormalized,tabletcorrectsit,sothedirectionitreturnswhenyousetthecalibrationmaydifferfromthevalueyoupassed.

ReturnValues

Iftabletfails,itreturnsnilandsetstheERRNOsystemvariabletoavalue

Page 411: less than or equalAutoLISP Functions

thatindicatesthereasonforthefailure(seeAutoLISPErrorCodesintheAutoLISPDeveloper'sGuide).Thiscanhappenifthedigitizerisnotatablet.

Examples

Averysimpletransformationthatcanbeestablishedwithtabletistheidentitytransformation:

(tablet1'(100)'(010)'(001)'(001))

Withthistransformationineffect,AutoCADwillreceive,effectively,rawdigitizercoordinatesfromthetablet.Forexample,ifyoupickthepointwithdigitizercoordinates(5000,15000),AutoCADwillseeitasthepointinyourdrawingwiththosesamecoordinates.

TheTABMODEsystemvariableallowsAutoLISProutinestotogglethetabletonandoff.

SeeAlsoTheCalibratingTabletstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 412: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

tblnext

Findsthenextiteminasymboltable

(tblnexttable-name[rewind])

Whentblnextisusedrepeatedly,itnormallyreturnsthenextentryinthespecifiedtableeachtime.Thetblsearchfunctioncansetthenextentrytoberetrieved.Iftherewindargumentispresentandisnotnil,thesymboltableisrewoundandthefirstentryinitisretrieved.

Arguments

table-name

Astringthatidentifiesasymboltable.Validtable-namevaluesare"LAYER","LTYPE","VIEW","STYLE","BLOCK","UCS","APPID","DIMSTYLE",and"VPORT".Theargumentisnotcasesensitive.

rewind

Ifthisargumentispresentandisnotnil,thesymboltableisrewoundandthefirstentryinitisretrieved.

ReturnValues

Ifasymboltableentryisfound,theentryisreturnedasalistofdottedpairsofDXF-typecodesandvalues.Iftherearenomoreentriesinthetable,nilisreturned.Deletedtableentriesareneverreturned.

Examples

Retrievethefirstlayerinthesymboltable:Command:(tblnext"layer"T)

((0."LAYER")(2."0")(70.0)(62.7)(6."CONTINUOUS"))

Page 413: less than or equalAutoLISP Functions

Thereturnvaluesrepresentthefollowing:

(0."LAYER")Symboltype

(2."0")Symbolname

(70.0)Flags

(62.7)Colornumber,negativeifoff

(6."CONTINUOUS")Linetypename

Notethatthereisno-1group.Thelastentryreturnedfromeachtableisstored,andthenextoneisreturnedeachtimetblnextiscalledforthattable.Whenyoubeginscanningatable,besuretosupplyanon-nilsecondargumenttorewindthetableandtoreturnthefirstentry.

Entriesretrievedfromtheblocktableincludea-2groupwiththeentitynameofthefirstentityintheblockdefinition(ifany).Forexample,thefollowingcommandobtainsinformationaboutablockcalledBOX:

Command:(tblnext"block")

((0."BLOCK")(2."BOX")(70.0)(109.02.00.0)(-2.<Entityname:1dca370>))

Thereturnvaluesrepresentthefollowing:

(0."BLOCK")Symboltype

(2."BOX")Symbolname

(70.0)Flags

(109.02.00.0)OriginX,Y,Z

(-2.<Entityname:1dca370>)Firstentity

Theentitynameinthe-2groupisacceptedbyentgetandentnext,butnotbyotherentityaccessfunctions.Forexample,youcannotusessaddtoputitinaselectionset.Byprovidingthe-2groupentitynametoentnext,youcanscantheentitiescomprisingablockdefinition;entnextreturnsnilafterthelastentityintheblockdefinition.

Ifablockcontainsnoentities,the-2groupreturnedbytblnextistheentitynameofitsendblkentity.

Note ThevportsfunctionreturnscurrentVPORTtableinformation;therefore,itmaybeeasiertousevportsasopposedtotblnexttoretrievethisinformation.

Pleasesendusyourcommentaboutthispage

Page 414: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

tblobjname

Returnstheentitynameofaspecifiedsymboltableentry

(tblobjnametable-namesymbol)

Arguments

table-name

Astringthatidentifiesthesymboltabletobesearched.Theargumentisnotcase-sensitive.

symbol

Astringidentifyingthesymboltobesearchedfor.

ReturnValues

Theentitynameofthesymboltableentry,iffound.

Theentitynamereturnedbytblobjnamecanbeusedinentgetandentmodoperations.

Examples

Thefollowingcommandsearchesfortheentitynameoftheblockentry“ESC-01”:

Command:(tblobjname"block""ESC-01")

<Entityname:1dca368>

Pleasesendusyourcommentaboutthispage

Page 415: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

tblsearch

Searchesasymboltableforasymbolname

(tblsearchtable-namesymbol[setnext])

Arguments

table-name

Astringthatidentifiesthesymboltabletobesearched.Thisargumentisnotcase-sensitive.

symbol

Astringidentifyingthesymbolnametobesearchedfor.Thisargumentisnotcase-sensitive.

setnext

Ifthisargumentissuppliedandisnotnil,thetblnextentrycounterisadjustedsothefollowingtblnextcallreturnstheentryaftertheonereturnedbythistblsearchcall.Otherwise,tblsearchhasnoeffectontheorderofentriesretrievedbytblnext.

ReturnValues

Iftblsearchfindsanentryforthegivensymbolname,itreturnsthatentryintheformatdescribedfortblnext.Ifnoentryisfound,tblsearchreturnsnil.

Examples

Thefollowingcommandsearchesforatextstylenamed“standard”:Command:(tblsearch"style""standard")

((0."STYLE")(2."STANDARD")(70.0)(40.0.0)(41.1.0)(50.0.0)(71.0)(42.0.3)(3."txt")(4.""))

Page 416: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 417: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

term_dialog

Terminatesallcurrentdialogboxesasiftheuserhadcanceledeachofthem

(term_dialog)

IfanapplicationisterminatedwhileanyDCLfilesareopen,AutoCADautomaticallycallsterm_dialog.Thisfunctionisusedmainlyforabortingnesteddialogboxes.

ReturnValues

Theterm_dialogfunctionalwaysreturnsnil.

Pleasesendusyourcommentaboutthispage

Page 418: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

terpri

Printsanewlinetothecommandline

(terpri)

TheterprifunctionisnotusedforfileI/O.Towriteanewlinetoafile,useprin1,princ,orprint.

ReturnValues

nil

Pleasesendusyourcommentaboutthispage

Page 419: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

textbox

Measuresaspecifiedtextobject,andreturnsthediagonalcoordinatesofaboxthatenclosesthetext

(textboxelist)

Arguments

elist

Anentitydefinitionlistdefiningatextobject,intheformatreturnedbyentget.Iffieldsthatdefinetextparametersotherthanthetextitselfareomittedfromelist,thecurrent(ordefault)settingsareused.Theminimumlistacceptedbytextboxisthatofthetextitself.

ReturnValues

Alistoftwopoints,ifsuccessful;otherwisenil.

Thepointsreturnedbytextboxdescribetheboundingboxofthetextobjectasifitsinsertionpointislocatedat(0,0,0)anditsrotationangleis0.Thefirstlistreturnedisgenerallythepoint(0.00.00.0)unlessthetextobjectisobliqueorvertical,oritcontainsletterswithdescenders(suchasgandp).Thevalueofthefirstpointlistspecifiestheoffsetfromthetextinsertionpointtothelower-leftcornerofthesmallestrectangleenclosingthetext.Thesecondpointlistspecifiestheupper-rightcornerofthatbox.Regardlessoftheorientationofthetextbeingmeasured,thepointlistreturnedalwaysdescribesthelower-leftandupper-rightcornersofthisboundingbox.

Examples

Thefollowingcommandsuppliesthetextandacceptsthecurrentdefaultsfortheremainingparameters:

Page 420: less than or equalAutoLISP Functions

Command:(textbox'((1."Helloworld.")))

((0.000124126-0.008233640.0)(3.036230.3103450.0))

Pleasesendusyourcommentaboutthispage

Page 421: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

textpage

Switchesfocusfromthedrawingareatothetextscreen

(textpage)

Thetextpagefunctionisequivalenttotextscr.

ReturnValues

nil

Pleasesendusyourcommentaboutthispage

Page 422: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

textscr

Switchesfocusfromthedrawingareatothetextscreen(liketheAutoCADF2functionkey)

(textscr)

ReturnValues

Thetextscrfunctionalwaysreturnsnil.

SeeAlsoThegraphscrfunction.

Pleasesendusyourcommentaboutthispage

Page 423: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

trace

AidsinAutoLISPdebugging

(trace[function...])

Thetracefunctionsetsthetraceflagforthespecifiedfunctions.Eachtimeaspecifiedfunctionisevaluated,atracedisplayappearsshowingtheentryofthefunction(indentedtothelevelofcallingdepth)andprintstheresultofthefunction.

IfVisualLISPisactive,traceoutputissenttotheVisualLISPTracewindow.IfVisualLISPisnotactive,traceoutputgoestotheAutoCADcommandwindow.

Note OnceyoustartVisualLISPduringanAutoCADsession,itremainsactiveuntilyouexitAutoCAD.Therefore,alltraceoutputprintsintheVisualLISPTracewindowfortheremainderofthatAutoCADsession.ExitingorclosingVisualLISPwhileAutoCADisrunningonlyclosestheIDEwindowsandplacesVisualLISPinaquiescentstate;itdoesnotresultinatrueshutdown.YoumustreopenVisualLISPtoviewtheoutputintheTracewindow.

Useuntracetoturnoffthetraceflag.

Arguments

function

Asymbolthatnamesafunction.Ifnoargumentissupplied,tracehasnoeffect.

ReturnValues

Thelastfunctionnamepassedtotrace.Ifnoargumentissupplied,tracereturnsnil.

Examples

Page 424: less than or equalAutoLISP Functions

Defineafunctionnamedfooandsetthetraceflagforthefunction:Command:(defunfoo(x)(if(>x0)(foo(1-x))))

FOO

Command:(tracefoo)

FOO

Invokefooandobservetheresults:Command:(foo3)

Entering(FOO3)

 Entering(FOO2)

  Entering(FOO1)

   Entering(FOO0)

   Result:nil

  Result:nil

 Result:nil

Result:nil

Clearthetraceflagbyinvokinguntrace:Command:(untracefoo)

FOO

SeeAlsoTheuntracefunction.

Pleasesendusyourcommentaboutthispage

Page 425: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

trans

Translatesapoint(oradisplacement)fromonecoordinatesystemtoanother

(transptfromto[disp])

Arguments

pt

Alistofthreerealsthatcanbeinterpretedaseithera3Dpointora3Ddisplacement(vector).

from

Anintegercode,entityname,or3Dextrusionvectoridentifyingthecoordinatesysteminwhichptisexpressed.Theintegercodecanbeoneofthefollowing:0 World(WCS)1 User(currentUCS)2 Ifusedwithcode0or1,thisindicatestheDisplayCoordinateSystem(DCS)ofthecurrentviewport.Whenusedwithcode3,itindicatestheDCSofthecurrentmodelspaceviewport.3 PaperspaceDCS(usedonlywithcode2)

to

Anintegercode,entityname,or3Dextrusionvectoridentifyingthecoordinatesystemofthereturnedpoint.Seethefromargumentforalistofvalidintegercodes.

disp

Ifpresentandisnotnil,thisargumentspecifiesthatptistobetreatedasa3Ddisplacementratherthanasapoint.

Page 426: less than or equalAutoLISP Functions

Ifyouuseanentitynameforthefromortoargument,itmustbepassedintheformatreturnedbytheentnext,entlast,entsel,nentsel,andssnamefunctions.ThisformatletsyoutranslateapointtoandfromtheObjectCoordinateSystem(OCS)ofaparticularobject.(Forsomeobjects,theOCSisequivalenttotheWCS;fortheseobjects,conversionbetweenOCSandWCSisanulloperation.)A3Dextrusionvector(alistofthreereals)isanothermethodofconvertingtoandfromanobject'sOCS.However,thisdoesnotworkforthoseobjectswhoseOCSisequivalenttotheWCS.

ReturnValues

A3Dpoint(ordisplacement)intherequestedtocoordinatesystem.

Examples

Inthefollowingexamples,theUCSisrotated90degreescounterclockwisearoundtheWCSZaxis:

Command:(trans'(1.02.03.0)01)

(2.0-1.03.0)

Command:(trans'(1.02.03.0)10)

(-2.01.03.0)

ThecoordinatesystemsarediscussedingreaterdetailinCoordinateSystemTransformationsintheAutoLISPDeveloper'sGuide.

Forexample,todrawalinefromtheinsertionpointofapieceoftext(withoutusingOsnap),youconvertthetextobject'sinsertionpointfromthetextobject'sOCStotheUCS.

(transtext-insert-pointtext-ename1)

YoucanthenpasstheresulttotheFromPointprompt.

Conversely,youmustconvertpoint(ordisplacement)valuestotheirdestinationOCSbeforefeedingthemtoentmod.Forexample,ifyouwanttomoveacircle(withoutusingtheMOVEcommand)bytheUCS-relativeoffset(1,2,3),youneedtoconvertthedisplacementfromtheUCStothecircle'sOCS:

(trans'(123)1circle-ename)

Thenyouaddtheresultingdisplacementtothecircle'scenterpoint.

Page 427: less than or equalAutoLISP Functions

Forexample,ifyouhaveapointenteredbytheuserandwanttofindoutwhichendofalineitlookscloserto,youconverttheuser'spointfromtheUCStotheDCS.

(transuser-point12)

Thenyouconverteachoftheline'sendpointsfromtheOCStotheDCS.

(transendpointline-ename2)

Fromthereyoucancomputethedistancebetweentheuser'spointandeachendpointoftheline(ignoringtheZcoordinates)todeterminewhichendlookscloser.

Thetransfunctioncanalsotransform2Dpoints.ItdoesthisbysettingtheZcoordinatetoanappropriatevalue.TheZcomponentuseddependsonthefromcoordinatesystemthatwasspecifiedandonwhetherthevalueistobeconvertedasapointorasadisplacement.Ifthevalueistobeconvertedasadisplacement,theZvalueisalways0.0;ifthevalueistobeconvertedasapoint,thefilled-inZvalueisdeterminedasshowninthefollowingtable:

Converted2DpointZvalues

From Filled-inZvalue

WCS 0.0

UCS Currentelevation

OCS 0.0

DCS Projectedtothecurrentconstructionplane(UCSXYplane+currentelevation)

PSDCS Projectedtothecurrentconstructionplane(UCSXYplane+currentelevation)

Page 428: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 429: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>TFunctions>

type

Returnsthetypeofaspecifieditem

(typeitem)

Arguments

item

Asymbol.

ReturnValues

Thedatatypeofitem.Itemsthatevaluatetonil(suchasunassignedsymbols)returnnil.Thedatatypeisreturnedasoneoftheatomslistedinthefollowingtable:

Datatypesreturnedbythetypefunction

Datatype Description

ENAME Entitynames

EXRXSUBR ExternalObjectARXapplications

FILE Filedescriptors

INT Integers

LIST Lists

PAGETB Functionpagingtable

Page 430: less than or equalAutoLISP Functions

PICKSET Selectionsets

REAL Floating-pointnumbers

SAFEARRAY Safearray

STR Strings

SUBR InternalAutoLISPfunctionsorfunctionsloadedfromcompiled(FASorVLX)filesFunctionsinLISPsourcefilesloadedfromtheAutoCADCommandpromptmayalsoappearasSUBR

SYM Symbols

VARIANT Variant

USUBR User-definedfunctionsloadedfromLISPsourcefiles

VLA-object ActiveXobjects

Examples

Forexample,giventhefollowingassignments:

(setqa123r3.45s"Hello!"x'(abc))

(setqf(open"name""r"))

then

(type'a)returnsSYM

(typea)returnsINT

(typef)returnsFILE

Page 431: less than or equalAutoLISP Functions

(typer)returnsREAL

(types)returnsSTR

(typex)returnsLIST

(type+)returnsSUBR

(typenil)returnsnil

Thefollowingcodeexampleusesthetypefunctionontheargumentpassedtoit:

(defunisint(a)

(if(=(typea)'INT)isTYPEinteger?

Tyes,returnT

nilno,returnnil

)

)

Pleasesendusyourcommentaboutthispage

Page 432: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

UFunctions

unload_dialogUnloadsaDCLfileuntraceClearsthetraceflagforthespecifiedfunctions

Pleasesendusyourcommentaboutthispage

Page 433: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>UFunctions>

unload_dialog

UnloadsaDCLfile

(unload_dialogdcl_id)

UnloadstheDCLfileassociatedwithdcl_id(obtainedfromapreviousnew_dialogcall)frommemory.

ItisgenerallynotnecessarytounloadaDCLdefinitionfrommemory,unlessyouarerunninglowonmemoryorneedtoupdatetheDCLdialogdefinitionfromanewfile.

Arguments

dcl_id

ADCLfileidentifierobtainedfromapreviousload_dialogcall.

ReturnValues

Theunload_dialogfunctionalwaysreturnsnil.

SeeAlsoTheload_dialogandnew_dialogfunctions.

Pleasesendusyourcommentaboutthispage

Page 434: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>UFunctions>

untrace

Clearsthetraceflagforthespecifiedfunctions

(untrace[function...])

Arguments

function

Asymbolthatnamesafunction.Iffunctionisnotspecified,untracehasnoeffect.

ReturnValues

Thelastfunctionnamepassedtountrace.Iffunctionwasnotspecified,untracereturnsnil.

Examples

Thefollowingcommandclearsthetraceflagforfunctionfoo:Command:(untracefoo)

FOO

Pleasesendusyourcommentaboutthispage

Page 435: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

VFunctions

vector_imageDrawsavectorinthecurrentlyactivedialogboximageverReturnsastringthatcontainsthecurrentAutoLISPversionnumbervl-acad-defunDefinesanAutoLISPfunctionsymbolasanexternalsubroutinevl-acad-undefunUndefinesanAutoLISPfunctionsymbolsoitisnolongeravailabletoObjectARXapplicationsvl-arx-importImportsObjectARX/ADSRXfunctionsintoaseparate-namespaceVLXvl-bb-refReturnsthevalueofavariablefromtheblackboardnamespacevl-bb-setSetsavariableintheblackboardnamespacevl-catch-all-applyPassesalistofargumentstoaspecifiedfunctionandtrapsanyexceptionsvl-catch-all-error-messageReturnsastringfromanerrorobjectvl-catch-all-error-pDetermineswhetheranargumentisanerrorobjectreturnedfromvl-catch-all-apply

Page 436: less than or equalAutoLISP Functions

vl-cmdfExecutesanAutoCADcommandvl-conspDetermineswhetherornotalistisnilvl-directory-filesListsallfilesinagivendirectoryvl-doc-exportMakesafunctionavailabletothecurrentdocumentvl-doc-importImportsapreviouslyexportedfunctionintoaVLXnamespacevl-doc-refRetrievesthevalueofavariablefromthecurrentdocument'snamespacevl-doc-setSetsthevalueofavariableinthecurrentdocument'snamespacevl-everyCheckswhetherthepredicateistrueforeveryelementcombinationvl-exit-with-errorPassescontrolfromaVLXerrorhandlertothe*error*functionofthecallingnamespacevl-exit-with-valueReturnsavaluetothefunctionthatinvokedtheVLXfromanothernamespacevl-file-copyCopiesorappendsthecontentsofonefiletoanotherfilevl-file-deleteDeletesafilevl-file-directory-pDeterminesifafilenamereferstoadirectoryvl-file-rename

Page 437: less than or equalAutoLISP Functions

Renamesafilevl-file-sizeDeterminesthesizeofafile,inbytesvl-file-systimeReturnslastmodificationtimeofthespecifiedfilevl-filename-baseReturnsthenameofafile,afterstrippingoutthedirectorypathandextensionvl-filename-directoryReturnsthedirectorypathofafile,afterstrippingoutthenameandextensionvl-filename-extensionReturnstheextensionfromafilename,afterstrippingouttherestofthenamevl-filename-mktempCalculatesauniquefilenametobeusedforatemporaryfilevl-get-resourceReturnsthetextstoredina.txtfilepackagedinaVLXvl-list*Constructsandreturnsalistvl-list->stringCombinesthecharactersassociatedwithalistofintegersintoastringvl-list-exported-functionsListsexportedfunctionsvl-list-lengthCalculateslistlengthofatruelistvl-list-loaded-vlxReturnsalistofallseparate-namespaceVLXfilesassociatedwiththecurrentdocumentvl-load-all

Page 438: less than or equalAutoLISP Functions

LoadsafileintoallopenAutoCADdocuments,andintoanydocumentsubsequentlyopenedduringthecurrentAutoCADsessionvl-load-comLoadsVisualLISPextensionstoAutoLISPvl-load-reactorsLoadsreactorsupportfunctionsvl-mkdirCreatesadirectoryvl-member-ifDeterminesifthepredicateistrueforoneofthelistmembersvl-member-if-notDeterminesifthepredicateisnilforoneofthelistmembersvl-positionReturnstheindexofthespecifiedlistitemvl-prin1-to-stringReturnsthestringrepresentationofLISPdataasifitwereoutputbytheprin1functionvl-princ-to-stringReturnsthestringrepresentationofLISPdataasifitwereoutputbytheprincfunctionvl-propagateCopiesthevalueofavariableintoallopendocumentnamespaces(andsetsitsvalueinanysubsequentdrawingsopenedduringthecurrentAutoCADsession)vl-registry-deleteDeletesthespecifiedkeyorvaluefromtheWindowsregistryvl-registry-descendentsReturnsalistofsubkeysorvaluenamesforthespecifiedregistrykeyvl-registry-readReturnsdatastoredintheWindowsregistryforthespecifiedkey/value

Page 439: less than or equalAutoLISP Functions

pairvl-registry-writeCreatesakeyintheWindowsregistryvl-removeRemoveselementsfromalistvl-remove-ifReturnsallelementsofthesuppliedlistthatfailthetestfunctionvl-remove-if-notReturnsallelementsofthesuppliedlistthatpassthetestfunctionvl-someCheckswhetherthepredicateisnotnilforoneelementcombinationvl-sortSortstheelementsinalistaccordingtoagivencomparefunctionvl-sort-iSortstheelementsinalistaccordingtoagivencomparefunction,andreturnstheelementindexnumbersvl-string->listConvertsastringintoalistofcharactercodesvl-string-eltReturnstheASCIIrepresentationofthecharacterataspecifiedpositioninastringvl-string-left-trimRemovesthespecifiedcharactersfromthebeginningofastringvl-string-mismatchReturnsthelengthofthelongestcommonprefixfortwostrings,startingatspecifiedpositionsvl-string-positionLooksforacharacterwiththespecifiedASCIIcodeinastringvl-string-right-trimRemovesthespecifiedcharactersfromtheendofastring

Page 440: less than or equalAutoLISP Functions

vl-string-searchSearchesforthespecifiedpatterninastringvl-string-substSubstitutesonestringforanother,withinastringvl-string-translateReplacescharactersinastringwithaspecifiedsetofcharactersvl-string-trimRemovesthespecifiedcharactersfromthebeginningandendofastringvl-symbol-nameReturnsastringcontainingthenameofasymbolvl-symbol-valueReturnsthecurrentvalueboundtoasymbolvl-symbolpIdentifieswhetherornotaspecifiedobjectisasymbolvl-unload-vlxUnloadaVLXapplicationthatisloadedinitsownnamespacevl-vbaloadLoadsaVBAprojectvl-vbarunRunsaVBAmacrovl-vlx-loaded-pDetermineswhetheraseparate-namespaceVLXiscurrentlyloadedvlax-3D-pointCreatesActiveX-compatible(variant)3Dpointstructurevlax-add-cmdAddscommandstotheAutoCADbuilt-incommandsetvlax-create-objectCreatesanewinstanceofanapplicationobjectvlax-curve-getArea

Page 441: less than or equalAutoLISP Functions

Returnstheareainsidethecurvevlax-curve-getClosestPointToReturnsthepoint(inWCS)onacurvethatisnearesttothespecifiedpointvlax-curve-getClosestPointToProjectionReturnstheclosestpoint(inWCS)onacurveafterprojectingthecurveontoaplanevlax-curve-getDistAtParamReturnsthelengthofthecurve'ssegmentfromthecurve'sbeginningtothespecifiedparametervlax-curve-getDistAtPointReturnsthelengthofthecurve'ssegmentbetweenthecurve'sstartpointandthespecifiedpointvlax-curve-getEndParamReturnstheparameteroftheendpointofthecurvevlax-curve-getEndPointReturnstheendpoint(inWCS)ofthecurvevlax-curve-getFirstDerivReturnsthefirstderivative(inWCS)ofacurveatthespecifiedlocationvlax-curve-getParamAtDistReturnstheparameterofacurveatthespecifieddistancefromthebeginningofthecurvevlax-curve-getParamAtPointReturnstheparameterofthecurveatthepointvlax-curve-getPointAtDistReturnsthepoint(inWCS)alongacurveatthedistancespecifiedbytheuservlax-curve-getPointAtParamReturnsthepointatthespecifiedparametervaluealongacurvevlax-curve-getSecondDeriv

Page 442: less than or equalAutoLISP Functions

Returnsthesecondderivative(inWCS)ofacurveatthespecifiedlocationvlax-curve-getStartParamReturnsthestartparameteronthecurvevlax-curve-getStartPointReturnsthestartpoint(inWCS)ofthecurvevlax-curve-isClosedDeterminesifthespecifiedcurveisclosed(thatis,thestartpointisthesameastheendpoint)vlax-curve-isPeriodicDeterminesifthespecifiedcurvehasaninfiniterangeinbothdirectionsandthereisaperiodvaluedT,suchthatapointonthecurveat(u+dT)=pointoncurve(u),foranyparameteruvlax-curve-isPlanarDeterminesifthereisaplanethatcontainsthecurvevlax-dump-objectListsanobject'sproperties,andoptionally,themethodsthatapplytotheobjectvlax-ename->vla-objectTransformsanentitytoaVLA-objectvlax-erased-pDetermineswhetheranobjectwaserasedvlax-forIteratesthroughacollectionofobjects,evaluatingeachexpressionvlax-get-acad-objectRetrievesthetoplevelAutoCADapplicationobjectforthecurrentAutoCADsessionvlax-get-objectReturnsarunninginstanceofanapplicationobjectvlax-get-or-create-object

Page 443: less than or equalAutoLISP Functions

Returnsarunninginstanceofanapplicationobject,orcreatesanewinstanceiftheapplicationisnotcurrentlyrunningvlax-get-propertyRetrievesaVLA-object'spropertyvlax-import-type-libraryImportsinformationfromatypelibraryvlax-invoke-methodCallsthespecifiedActiveXmethodvlax-ldata-deleteErasesLISPdatafromadrawingdictionaryvlax-ldata-getRetrievesLISPdatafromadrawingdictionaryoranobjectvlax-ldata-listListsLISPdatainadrawingdictionaryvlax-ldata-putStoresLISPdatainadrawingdictionaryoranobjectvlax-ldata-testDeterminesifdatacanbesavedoverasessionboundaryvlax-make-safearrayCreatesasafearrayvlax-make-variantCreatesavariantdatatypevlax-map-collectionAppliesafunctiontoallobjectsinacollectionvlax-method-applicable-pDeterminesifanobjectsupportsaparticularmethodvlax-object-released-pDeterminesifanobjecthasbeenreleasedvlax-product-key

Page 444: less than or equalAutoLISP Functions

ReturnstheAutoCADWindowsregistrypathvlax-property-available-pDeterminesifanobjecthasaspecifiedpropertyvlax-put-propertySetsthepropertyofanActiveXobjectvlax-read-enabled-pDeterminesifanobjectcanbereadvlax-release-objectReleasesadrawingobjectvlax-remove-cmdRemovesasinglecommandoracommandgroupvlax-safearray-fillStoresdataintheelementsofasafearrayvlax-safearray-get-dimReturnsthenumberofdimensionsinasafearrayobjectvlax-safearray-get-elementReturnsanelementfromanarrayvlax-safearray-get-l-boundReturnsthelowerboundary(startingindex)ofadimensionofanarrayvlax-safearray-get-u-boundReturnstheupperboundary(endindex)ofadimensionofanarrayvlax-safearray-put-elementAddsanelementtoanarrayvlax-safearray-typeReturnsthedatatypeofasafearrayvlax-safearray->listReturnstheelementsofasafearrayinlistformvlax-tmatrixReturnsasuitablerepresentationfora4x4transformationmatrixtobe

Page 445: less than or equalAutoLISP Functions

usedinVLAmethodsvlax-typeinfo-available-pDetermineswhetherTypeLibinformationispresentforthespecifiedtypeofobjectvlax-variant-change-typeReturnsthevalueofavariantafterchangingitfromonedatatypetoanothervlax-variant-typeDeterminesthedatatypeofavariantvlax-variant-valueReturnsthevalueofavariantvlax-vla-object->enameTransformsaVLA-objecttoanAutoLISPentityvlax-write-enabled-pDeterminesifanAutoCADdrawingobjectcanbemodifiedvlisp-compileCompilesAutoLISPsourcecodeintoaFASfilevlr-acdb-reactorConstructsareactorobjectthatnotifieswhenanobjectisaddedto,modifiedin,orerasedfromadrawingdatabasevlr-addEnablesadisabledreactorobjectvlr-added-pTeststodetermineifareactorobjectisenabledvlr-beep-reactionProducesabeepsoundvlr-command-reactorConstructsaneditorreactorthatnotifiesofacommandeventvlr-current-reaction-nameReturnsthename(symbol)ofthecurrentevent,ifcalledfromwithina

Page 446: less than or equalAutoLISP Functions

reactor'scallbackvlr-dataReturnsapplication-specificdataassociatedwithareactorvlr-data-setOverwritesapplication-specificdataassociatedwithareactorvlr-deepclone-reactorConstructsaneditorreactorobjectthatnotifiesofadeepcloneeventvlr-docmanager-reactorConstructsareactorobjectthatnotifiesofeventsrelatingtodrawingdocumentsvlr-dwg-reactorConstructsaneditorreactorobjectthatnotifiesofadrawingevent(forexample,openingorclosingadrawingfile)vlr-dxf-reactorConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtoreadingorwritingaDXFfilevlr-editor-reactorConstructsaneditorreactorobjectvlr-insert-reactorConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtoblockinsertionvlr-linker-reactorConstructsareactorobjectthatnotifiesyourapplicationeverytimeanObjectARXapplicationisloadedorunloadedvlr-lisp-reactorConstructsaneditorreactorobjectthatnotifiesofaLISPeventvlr-miscellaneous-reactorConstructsaneditorreactorobjectthatdoesnotfallunderanyothereditorreactortypesvlr-mouse-reactor

Page 447: less than or equalAutoLISP Functions

Constructsaneditorreactorobjectthatnotifiesofamouseevent(forexample,adouble-click)vlr-notificationDetermineswhetherornotareactorwillfireifitsassociatednamespaceisnotactivevlr-object-reactorConstructsadrawingobjectreactorobjectvlr-owner-addAddsanobjecttothelistofownersofanobjectreactorvlr-owner-removeRemovesanobjectfromthelistofownersofanobjectreactorvlr-ownersReturnsthelistofownersofanobjectreactorvlr-persMakesareactorpersistentvlr-pers-listReturnsalistofpersistentreactorsinthecurrentdrawingdocumentvlr-pers-pDetermineswhetherareactorispersistentvlr-pers-releaseMakesareactortransientvlr-reaction-nameReturnsalistofallpossiblecallbackconditionsforthisreactortypevlr-reaction-setAddsorreplacesacallbackfunctioninareactorvlr-reactionsReturnsalistofpairs(event-name.callback_function)forthereactorvlr-reactorsReturnsalistofexistingreactors

Page 448: less than or equalAutoLISP Functions

vlr-removeDisablesareactorvlr-remove-allDisablesallreactorsofthespecifiedtypevlr-set-notificationDefineswhetherareactor'scallbackfunctionwillexecuteifitsassociatednamespaceisnotactivevlr-sysvar-reactorConstructsaneditorreactorobjectthatnotifiesofachangetoasystemvariablevlr-toolbar-reactorConstructsaneditorreactorobjectthatnotifiesofachangetothebitmapsinatoolbarvlr-trace-reactionApredefinedcallbackfunctionthatprintsoneormorecallbackargumentsintheTracewindowvlr-typeReturnsasymbolrepresentingthereactortypevlr-typesReturnsalistofallreactortypesvlr-undo-reactorConstructsaneditorreactorobjectthatnotifiesofanundoeventvlr-wblock-reactorConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtowritingablockvlr-window-reactorConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtomovingorsizinganAutoCADwindowvlr-xref-reactorConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtoattachingormodifyingXREFs

Page 449: less than or equalAutoLISP Functions

vportsReturnsalistofviewportdescriptorsforthecurrentviewportconfiguration

Pleasesendusyourcommentaboutthispage

Page 450: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vector_image

Drawsavectorinthecurrentlyactivedialogboximage

(vector_imagex1y1x2y2color)

Thisfunctiondrawsavectorinthecurrentlyactivedialogboximage(openedbystart_image)fromthepoint(x1,y1)to(x2,y2).Theorigin(0,0)istheupper-leftcorneroftheimage.Youcanobtainthecoordinatesofthelower-rightcornerbycallingthedimensionfunctions(dimx_tileanddimy_tile).

Arguments

x1

Xcoordinateofthefirstpoint.

y1

Ycoordinateofthefirstpoint.

x2

Xcoordinateofthesecondpoint.

y2

Ycoordinateofthesecondpoint.

color

AnAutoCADcolornumber,oroneofthelogicalcolornumbersshowninthefollowingtable:

Symbolicnamesforcolorattribute

Color

Page 451: less than or equalAutoLISP Functions

number ADImnemonic Description

-2 BGLCOLOR CurrentbackgroundoftheAutoCADdrawingarea

-15 DBGLCOLOR Currentdialogboxbackgroundcolor

-16 DFGLCOLOR Currentdialogboxforegroundcolor(text)

-18 LINELCOLOR Currentdialogboxlinecolor

ReturnValues

Anintegerrepresentingthecolorofthevector.

Examples

(setqcolor-2);;colorofAutoCADdrawingarea

(vector_image

0

0

(dimx_tile"slide_tile")

(dimy_tile"slide_tile")

color

)

(end_image)

Pleasesendusyourcommentaboutthispage

Page 452: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

ver

ReturnsastringthatcontainsthecurrentAutoLISPversionnumber

(ver)

Theverfunctioncanbeusedtocheckthecompatibilityofprograms.

ReturnValues

Thestringreturnedtakesthefollowingform:

"VisualLISPversion(nn)"

whereversionisthecurrentversionnumberandnnisatwo-letterlanguagedescription.

Examplesofthetwo-letterlanguagedescriptionsareasfollows:

(de)German

(en)US/UK

(es)Spanish

(fr)French

(it)Italian

ExamplesCommand:(ver)

"VisualLISP2006(en)"

Pleasesendusyourcommentaboutthispage

Page 453: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-acad-defun

DefinesanAutoLISPfunctionsymbolasanexternalsubroutine

(vl-acad-defun'symbol)

Arguments

symbol

Asymbolidentifyingafunction.

Ifafunctiondoesnothavethec:prefix,andyouwanttobeabletoinvokethisfunctionfromanexternalObjectARXapplication,youcanusevl-acad-defuntomakethefunctionaccessible.

ReturnValues

Unspecified.

Pleasesendusyourcommentaboutthispage

Page 454: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-acad-undefun

UndefinesanAutoLISPfunctionsymbolsoitisnolongeravailabletoObjectARXapplications

(vl-acad-undefun'symbol)

Arguments

symbol

Asymbolidentifyingafunction.

Youcanusevl-acad-undefuntoundefineac:functionorafunctionthatwasexposedviavl-acad-defun.

ReturnValues

Tifsuccessful;nilifunsuccessful(forexample,thefunctionwasnotdefinedinAutoLISP).

Pleasesendusyourcommentaboutthispage

Page 455: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-arx-import

ImportsObjectARX/ADSRXfunctionsintoaseparate-namespaceVLX

(vl-arx-import['function|"application"])

Bydefault,separate-namespaceVLXapplicationsdonotimportanyfunctionsfromObjectARX/ADSRXapplications.Usevl-arx-importtoexplicitlyimportfunctionsfromObjectARX/ADSRXapplications.

Arguments

function

Asymbolnamingthefunctiontoimport.

application

Astringnamingtheapplicationwhosefunctionsaretobeimported.

Ifnoargument(ornil)isspecified,vl-arx-importimportsallfunctionnamesfromthecurrentdocumentnamespace.

ReturnValues

Unspecified.

IfexecutedfromadocumentVLX,thisfunctiondoesnothingandreturnsnil,asallADS-DEFUNfunctionnamesareautomaticallyimportedtodocumentVLXapplications.

Examples

Toseehowvl-arx-importworks,trythefollowing:

1. CopythefollowingcodeintotheVLISPeditorandsavethefile:

(vl-doc-export'testarx)

Page 456: less than or equalAutoLISP Functions

(defuntestarx()

(princ"ThisfunctiontestsanObjectARXapplication")

(vl-arx-import'c:cal)

(c:cal)

)

2. UseMakeApplicationtobuildaVLXwiththiscode.SelectSeparate-NamespaceApplicationOptions.

3. Loadgeomcal.arx,ifitisnotalreadyloaded.

4. Loadandruntheapplication.Toverifytheeffectofvl-arx-import,commentoutthevl-arx-importcallinthecode,savethechange,thenrebuildandruntheapplication.Withoutthevl-arx-importcall,thec:calfunctionwillnotbefound.

Intheexampleabove,youcouldhavereplacedthevl-arx-importcallwiththefollowing:

(vl-arx-import"geomcal.arx")

Thiswouldimportallfunctionsdefinedingeomcal.arx,includingc:cal.

Pleasesendusyourcommentaboutthispage

Page 457: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-bb-ref

Returnsthevalueofavariablefromtheblackboardnamespace

(vl-bb-ref'variable)

Arguments

'variable

Asymbolidentifyingthevariabletoberetrieved.

ReturnValues

Thevalueofthevariablenamedbysymbol.

Examples

Setavariableintheblackboard:Command:(vl-bb-set'foobar"Roottoottoot")

"Roottoottoot"

Usevl-bb-reftoretrievethevalueoffoobarfromtheblackboard:Command:(vl-bb-ref'foobar)

"Roottoottoot"

SeeAlsoThevl-bb-setfunction.SharingDataBetweenNamespacesintheAutoLISPDeveloper'sGuideforadescriptionoftheblackboardnamespace.

Pleasesendusyourcommentaboutthispage

Page 458: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-bb-set

Setsavariableintheblackboardnamespace

(vl-bb-set'symbolvalue)

Arguments

'symbol

Asymbolnamingthevariabletobeset.

value

Anyvalue,exceptafunction.

ReturnValues

Thevalueyouassignedtosymbol.

ExamplesCommand:(vl-bb-set'foobar"Roottoottoot")

"Roottoottoot"

Command:(vl-bb-ref'foobar)

"Roottoottoot"

SeeAlsoThevl-bb-reffunction.SharingDataBetweenNamespacesintheAutoLISPDeveloper'sGuideforadescriptionoftheblackboardnamespace.

Pleasesendusyourcommentaboutthispage

Page 459: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-catch-all-apply

Passesalistofargumentstoaspecifiedfunctionandtrapsanyexceptions

(vl-catch-all-apply'functionlist)

Arguments

'function

Afunction.Thefunctionargumentcanbeeitherasymbolidentifyingadefun,oralambdaexpression.

list

Alistcontainingargumentstobepassedtothefunction.

ReturnValues

Theresultofthefunctioncall,ifsuccessful.Ifanerroroccurs,vl-catch-all-applyreturnsanerrorobject.

Examples

Ifthefunctioninvokedbyvl-catch-all-applycompletessuccessfully,itisthesameasusingapply,asthefollowingexamplesshow:

_$(setqcatchit(apply'/

'(505)))10

_$(setqcatchit(vl-catch-all-apply

'/'(505)))10

Thebenefitofusingvl-catch-all-applyisthatitallowsyoutointercepterrorsandcontinueprocessing.Seewhathappenswhenyoutrytodividebyzero

Page 460: less than or equalAutoLISP Functions

usingapply:

_$(setqcatchit(apply'/

'(500)));error:dividebyzero

Whenyouuseapply,anexceptionoccursandanerrormessagedisplays.

Hereisthesameoperationusingvl-catch-all-apply:

_$(setqcatchit(vl-catch-all-apply

'/'(500)))#<%catch-all-apply-error%>

Thevl-catch-all-applyfunctiontrapstheerrorandreturnsanerrorobject.Usevl-catch-all-error-messagetoseetheerrormessagecontainedintheerrorobject:

_$(vl-catch-all-error-messagecatchit)

"dividebyzero"

SeeAlsoThe*error*,vl-catch-all-error-p,andvl-catch-all-error-messagefunctions.TheErrorHandlinginAutoLISPtopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 461: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-catch-all-error-message

Returnsastringfromanerrorobject

(vl-catch-all-error-messageerror-obj)

Arguments

error-obj

Anerrorobjectreturnedbyvl-catch-all-apply.

ReturnValues

Astringcontaininganerrormessage.

Examples

Dividebyzerousingvl-catch-all-apply:

_$(setqcatchit(vl-catch-all-apply

'/'(500)))#<%catch-all-apply-error%>

Thevl-catch-all-applyfunctiontrapstheerrorandreturnsanerrorobject.Usevl-catch-all-error-messagetoseetheerrormessagecontainedintheerrorobject:

_$(vl-catch-all-error-messagecatchit)

"dividebyzero"

SeeAlsoThe*error*,vl-catch-all-apply,andvl-catch-all-error-pfunctions.TheErrorHandlinginAutoLISPtopicintheAutoLISPDeveloper'sGuide.

Page 462: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 463: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-catch-all-error-p

Determineswhetheranargumentisanerrorobjectreturnedfromvl-catch-all-apply

(vl-catch-all-error-parg)

Arguments

arg

Anyargument.

ReturnValues

T,ifthesuppliedargumentisanerrorobjectreturnedfromvl-catch-all-apply;otherwisenil.

Examples

Dividebyzerousingvl-catch-all-apply:

_$(setqcatchit(vl-catch-all-apply

'/'(500)))#<%catch-all-apply-error%>

Usevl-catch-all-error-ptodetermineifthevaluereturnedbyvl-catch-all-applyisanerrorobject:

_$(vl-catch-all-error-p

catchit)T

SeeAlsoThe*error*,vl-catch-all-apply,andvl-catch-all-error-message

Page 464: less than or equalAutoLISP Functions

functions.TheErrorHandlinginAutoLISPtopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 465: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-cmdf

ExecutesanAutoCADcommand

Arguments

(vl-cmdf[arguments]...)

Thevl-cmdffunctionissimilartothecommandfunction,butdiffersfromcommandinthewayitevaluatestheargumentspassedtoit.Thevl-cmdffunctionevaluatesallthesuppliedargumentsbeforeexecutingtheAutoCADcommand,andwillnotexecutetheAutoCADcommandifitdetectsanerrorduringargumentevaluation.Incontrast,thecommandfunctionpasseseachargumentinturntoAutoCAD,sothecommandmaybepartiallyexecutedbeforeanerrorisdetected.

Ifyourcommandcallincludesacalltoanotherfunction,vl-cmdfexecutesthecallbeforeitexecutesyourcommand,whilecommandexecutesthecallafteritbeginsexecutingyourcommand.

SomeAutoCADcommandsmayworkcorrectlywheninvokedthroughvl-cmdf,whilefailingwheninvokedthroughcommand.Thevl-cmdffunctionmainlyovercomesthelimitationofnotbeingabletouseget.xxxfunctionsinsidecommand.

Arguments

arguments

AutoCADcommandsandtheiroptions.Theargumentstothevl-cmdffunctioncanbestrings,reals,integers,orpoints,asexpectedbythepromptsequenceoftheexecutedcommand.Anullstring("")isequivalenttopressingENTERonthekeyboard.Invokingvl-cmdfwithnoargumentisequivalenttopressingESCandcancelsmostAutoCADcommands.

Page 466: less than or equalAutoLISP Functions

ReturnValues

T

Notethatifyouissuevl-cmdffromVisualLISP,focusdoesnotchangetotheAutoCADwindow.Ifthecommandrequiresuserinput,you'llseethereturnvalue(T)intheConsolewindow,butAutoCADwillbewaitingforinput.YoumustmanuallyactivatetheAutoCADwindowandrespondtotheprompts.Untilyoudoso,anysubsequentcommandswillfail.

Examples

Thedifferencesbetweencommandandvl-cmdfareeasiertoseeifyouenterthefollowingcallsattheAutoCADCommandprompt,ratherthantheVLISPConsoleprompt:

Command:(command"line"(getpoint"point?")'(00)"")

lineSpecifyfirstpoint:point?

Specifynextpointor[Undo]:

Command:nil

Usingcommand,theLINEcommandexecutesfirst;thenthegetpointfunctioniscalled.

Command:(VL-CMDF"line"(getpoint"point?")'(00)"")

point?lineSpecifyfirstpoint:

Specifynextpointor[Undo]:

Command:T

Usingvl-cmdf,thegetpointfunctioniscalledfirst(noticethe“point?”promptfromgetpoint);thentheLINEcommandexecutes.

Thefollowingexamplesshowthesamecommands,butpassaninvalidpointlistargumenttotheLINEcommand.Noticehowtheresultsdiffer:

Command:(command"line"(getpoint"point?")'(0)"")

lineSpecifyfirstpoint:point?

Specifynextpointor[Undo]:

Command:ERASEnil

Selectobjects:Specifyoppositecorner:*Cancel*

0found

ThecommandfunctionpasseseachargumentinturntoAutoCAD,without

Page 467: less than or equalAutoLISP Functions

evaluatingtheargument,sotheinvalidpointlistisundetected.Command:(VL-CMDF"line"(getpoint"point?")'(0)"")

point?ApplicationERROR:Invalidentity/pointlist.

nil

Becausevl-cmdfevaluateseachargumentbeforepassingthecommandtoAutoCAD,theinvalidpointlistisdetectedandthecommandisnotexecuted.

SeeAlsoThecommandfunction.

Pleasesendusyourcommentaboutthispage

Page 468: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-consp

Determineswhetherornotalistisnil

(vl-consplist-variable)

Thevl-conspfunctiondetermineswhetheravariablecontainsavalidlistdefinition.

Arguments

list-variable

Alist.

ReturnValues

T,iflist-variableisalistandisnotnil;otherwisenil.

Examples

_$(vl-conspnil)nil

_$(vl-conspt)nil

_$(vl-consp(cons0"LINE"))T

Pleasesendusyourcommentaboutthispage

Page 469: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-directory-files

Listsallfilesinagivendirectory

(vl-directory-files[directorypatterndirectories])

Arguments

directory

Astringnamingthedirectorytocollectfilesfor;ifnilorabsent,vl-directory-filesusesthecurrentdirectory.

pattern

AstringcontainingaDOSpatternforthefilename;ifnilorabsent,vl-directory-filesassumes“*.*”

directories

Anintegerthatindicateswhetherthereturnedlistshouldincludedirectorynames.Specifyoneofthefollowing:-1 Listdirectoriesonly.0 Listfilesanddirectories(thedefault).1 Listfilesonly.

ReturnValues

Alistoffileandpathnames;otherwisenilifnofilesmatchthespecifiedpattern.

Examples

_$(vl-directory-files"c:/acadwin"

"acad*.exe")("ACAD.EXE""ACADAPP.EXE""ACADL.EXE""ACADPS.EXE")

Page 470: less than or equalAutoLISP Functions

_$(vl-directory-files"e:/acadwin"

nil-1)(".""..""SUPPORT""SAMPLE""ADS""FONTS""IGESFONT""SOURCE""ASE")

_$(vl-directory-files"E:/acad13c4"

nil-1)(".""..""WIN""COM""DOS")

Pleasesendusyourcommentaboutthispage

Page 471: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-doc-export

Makesafunctionavailabletothecurrentdocument

(vl-doc-export'function)

WhenissuedfromaVLXthatrunsinitsownnamespace,vl-doc-exportexposesthespecifiedfunctiontoanydocumentnamespacethatloadstheVLX.

Thevl-doc-exportfunctionshouldbeusedonlyatthetoplevelinafile,andneverinsideotherforms(forexample,notwithinadefun).

Arguments

'function

Asymbolnamingthefunctiontobeexported.

ReturnValues

Unspecified.

Examples

Thefollowingcodeshowsthecontentsofafilenamedkertrats.lsp.ThisfileiscompiledintoaVLXthatrunsinitsownnamespace.TheVLXfileisnamedkertrats.vlx.Thevl-doc-exportcallmakesthekertratsfunctionvisibletoanydocumentthatloadskertrats.vlx:

(vl-doc-export'kertrats)

(defunkertrats()

(princ"Thisfunctiongoesnowhere")

)

Pleasesendusyourcommentaboutthispage

Page 472: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-doc-import

ImportsapreviouslyexportedfunctionintoaVLXnamespace

(vl-doc-importapplication['function...])

Thisfunctioncanbeusedinaseparate-namespaceVLXtoimportafunctionthatwaspreviouslyexportedfromanotherVLXloadedfromthesamedocument.

Thevl-doc-importfunctionshouldbeusedonlyatthetoplevelinafile,andneverinsideotherforms(forexample,notwithinadefun).

Arguments

application

AstringnamingtheVLXapplicationwhosefunctionsaretobeimported.Donotincludethe.vlxextensioninthename.

function

Oneormoresymbolsnamingfunctionstobeimported.Ifnofunctionsarespecified,allfunctionsexportedbyapplicationwillbeimported.

ReturnValues

Unspecified.

Examples

Importfunctionldatagetfromtheldatatestapplication:

(vl-doc-import"ldatatest"'ldataget)

nil

Page 473: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 474: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-doc-ref

Retrievesthevalueofavariablefromthecurrentdocument'snamespace

Thisfunctioncanbeusedbyaseparate-namespaceVLXapplicationtoretrievethevalueofavariablefromthecurrentdocument'snamespace.

(vl-doc-ref'symbol)

Arguments

'symbol

Asymbolnamingavariable.

ReturnValues

Thevalueofthevariableidentifiedbysymbol.

ExamplesCommand:(vl-doc-ref'foobar)

"Rinkydinkystinky"

SeeAlsoThevl-doc-setfunction.

Pleasesendusyourcommentaboutthispage

Page 475: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-doc-set

Setsthevalueofavariableinthecurrentdocument'snamespace

(vl-doc-set'symbolvalue)

ThisfunctioncanbeusedbyaVLXapplicationtosetthevalueofavariablethatresidesinthecurrentdocument'snamespace.

Ifexecutedwithinadocumentnamespace,vl-doc-setisequivalenttoset.

Arguments

'symbol

Asymbolnamingavariable.

value

Anyvalue.

ReturnValues

Thevalueset.

ExamplesCommand:(vl-doc-set'foobar"Rinkydinkystinky")

"Rinkydinkystinky"

SeeAlsoThevl-doc-reffunction.

Pleasesendusyourcommentaboutthispage

Page 476: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-every

Checkswhetherthepredicateistrueforeveryelementcombination

(vl-everypredicate-functionlist[list]...)

Thevl-everyfunctionpassesthefirstelementofeachsuppliedlistasanargumenttothetestfunction,followedbythenextelementfromeachlist,andsoon.Evaluationstopsassoonasoneofthelistsrunsout.

Arguments

predicate-function

Thetestfunction.Thiscanbeanyfunctionthatacceptsasmanyargumentsastherearelistsprovidedwithvl-every,andreturnsTonanyuser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

ReturnValues

T,ifpredicate-functionreturnsanon-nilvalueforeveryelementcombination;otherwisenil.

Examples

Checkwhetherthereareanyemptyfilesinthecurrentdirectory:

Page 477: less than or equalAutoLISP Functions

_$(vl-every

'(lambda(fnm)(>(vl-file-size

fnm)0))

(vl-directory-files

nilnil1))T

CheckwhetherthelistofnumbersinNLSTisorderedby'<=:

_$(setqnlst(list02pi

pi4))(023.141593.141594)

_$(vl-every'<=nlst

(cdrnlst))T

Comparetheresultsofthefollowingexpressions:

_$(vl-every'='(12)'(1

3))nil

_$(vl-every'='(12)'(1

23))T

Thefirstexpressionreturnednilbecausevl-everycomparedthesecondelementineachlistandtheywerenotnumericallyequal.ThesecondexpressionreturnedTbecausevl-everystoppedcomparingelementsafterithadprocessedalltheelementsintheshorterlist(12),atwhichpointthelistswerenumericallyequal.Iftheendofalistisreached,vl-everyreturnsanon-nilvalue.

Thefollowingexampledemonstratestheresultwhenvl-everyevaluatesonelistthatcontainsintegerelementsandanotherlistthatisnil:

_$(setqalist(list12

34))(1234)

_$(setqjunknil)nil

_$(vl-every'=junkalist)

Page 478: less than or equalAutoLISP Functions

T

ThereturnvalueisTbecausevl-everyrespondstothenillistasifithasreachedtheendofthelist(eventhoughthepredicatehasn'tyetbeenappliedtoanyelements).Andsincetheendofalisthasbeenreached,vl-everyreturnsanon-nilvalue.

Pleasesendusyourcommentaboutthispage

Page 479: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-exit-with-error

PassescontrolfromaVLXerrorhandlertothe*error*functionofthecallingnamespace

(vl-exit-with-errormsg)

ThisfunctionisusedbyVLXapplicationsthatrunintheirownnamespace.Whenvl-exit-with-errorexecutes,itcallsthe*error*function,thestackisunwound,andcontrolreturnstoacommandprompt.

Arguments

msg

Astring.

ReturnValues

None.

Examples

Thefollowingcodeillustratestheuseofvl-exit-with-errortopassastringtothe*error*functionofthecallingnamespace:

(defun*error*(msg)

...;processinginVLXnamespace/executioncontext

(vl-exit-with-error(strcat"Myapplicationbombed!"msg)))

SeeAlsoThe*error*andvl-exit-with-valuefunctions.TheHandlingErrorsinanMDIEnvironmenttopicintheAutoLISPDeveloper'sGuide.

Page 480: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 481: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-exit-with-value

ReturnsavaluetothefunctionthatinvokedtheVLXfromanothernamespace

(vl-exit-with-valuevalue)

AVLX*error*handlercanusethevl-exit-with-valuefunctiontoreturnavaluetotheprogramthatcalledtheVLX.

Arguments

value

Anyvalue.

ReturnValues

value

Examples

Thefollowingexampleusesvl-exit-with-valuetoreturntheintegervalue3tothefunctionthatinvokedtheVLX:

(defun*error*(msg)

...;processinginVLX-Tnamespace/executioncontext

(vl-exit-with-value3))

SeeAlsoThe*error*andvl-exit-with-errorfunctions.TheHandlingErrorsinanMDIEnvironmenttopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 482: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-copy

Copiesorappendsthecontentsofonefiletoanotherfile

(vl-file-copysource-filedestination-file[append])

Copyorappendthecontentsofonefiletoanotherfile.Thevl-file-copyfunctionwillnotoverwriteanexistingfile;itwillonlyappendtoit.

Arguments

source-file

Astringnamingthefiletobecopied.Ifyoudonotspecifyafullpathname,vl-file-copylooksintheAutoCADdefaultdrawingdirectory.

destination-file

Astringnamingthedestinationfile.Ifyoudonotspecifyapathname,vl-file-copywritestotheAutoCADdefaultdrawingdirectory.

append

Ifspecifiedandnotnil,source-fileisappendedtodestination-file(thatis,copiedtotheendofthedestinationfile).

ReturnValues

Aninteger,ifthecopywassuccessful;otherwisenil.

Sometypicalreasonsforreturningnilare

source-fileisnotreadable

source-fileisadirectory

append?isabsentornilanddestination-fileexists

Page 483: less than or equalAutoLISP Functions

destination-filecannotbeopenedforoutput(thatis,itisanillegalfilenameorawrite-protectedfile)

source-fileisthesameasdestination-file

Examples

Copyautoexec.battonewauto.bat:

_$(vl-file-copy"c:/autoexec.bat"

"c:/newauto.bat")1417

Copytest.battonewauto.bat:

_$(vl-file-copy"c:/test.bat"

"c:/newauto.bat")nil

Thecopyfailsbecausenewauto.batalreadyexists,andtheappendargumentwasnotspecified.

Repeatthepreviouscommand,butspecifyappend:

_$(vl-file-copy"c:/test.bat"

"c:/newauto.bat"T)185

ThecopyissuccessfulbecauseTwasspecifiedfortheappendargument.

Pleasesendusyourcommentaboutthispage

Page 484: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-delete

Deletesafile

(vl-file-deletefilename)

Arguments

filename

Astringcontainingthenameofthefiletobedeleted.Ifyoudonotspecifyafullpathname,vl-file-deletesearchestheAutoCADdefaultdrawingdirectory.

ReturnValues

Tifsuccessful;nilifdeletefailed.

Examples

Deletenewauto.bat:

_$(vl-file-delete"newauto.bat")nil

Nothingwasdeletedbecausethereisnonewauto.batfileintheAutoCADdefaultdrawingdirectory.

Deletethenewauto.batfileinthec:\directory:

_$(vl-file-delete"c:/newauto.bat")T

Thedeletewassuccessfulbecausethefullpathnameidentifiedanexistingfile.

Page 485: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 486: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-directory-p

Determinesifafilenamereferstoadirectory

(vl-file-directory-pfilename)

Arguments

filename

Astringcontainingafilename.Ifyoudonotspecifyafullpathname,vl-file-directory-psearchesonlytheAutoCADdefaultdrawingdirectory.

ReturnValues

T,iffilenameisthenameofadirectory;nilifitisnot.

Examples

_$(vl-file-directory-p"sample")T

_$(vl-file-directory-p"yinyang")nil

_$(vl-file-directory-p"c:/My

Documents")T

_$(vl-file-directory-p"c:/My

Documents/visuallisp/yinyang.lsp")nil

Pleasesendusyourcommentaboutthispage

Page 487: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-rename

Renamesafile

(vl-file-renameold-filenamenew-filename)

Arguments

old-filename

Astringcontainingthenameofthefileyouwanttorename.Ifyoudonotspecifyafullpathname,vl-file-renamelooksintheAutoCADdefaultdrawingdirectory.

new-filename

Astringcontainingthenewnametobeassignedtothefile.

Note Ifyoudonotspecifyapathname,vl-file-renamewritestherenamedfiletotheAutoCADdefaultdrawingdirectory.

ReturnValues

T,ifrenamingcompletedsuccessfully;nilifrenamingfailed.

Examples

_$(vl-file-rename"c:/newauto.bat"

"c:/myauto.bat")T

Pleasesendusyourcommentaboutthispage

Page 488: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-size

Determinesthesizeofafile,inbytes

(vl-file-sizefilename)

Arguments

filename

Astringnamingthefiletobesized.Ifyoudonotspecifyafullpathname,vl-file-sizesearchestheAutoCADdefaultdrawingdirectoryforthefile.

ReturnValues

Ifsuccessful,vl-file-sizereturnsanintegershowingthesizeoffilename.Ifthefileisnotreadable,vl-file-sizereturnsnil.Iffilenameisadirectoryoranemptyfile,vl-file-sizereturns0.

Examples

_$(vl-file-size"c:/autoexec.bat")1417

_$(vl-file-size"c:/")0

Intheprecedingexample,vl-file-sizereturned0becausec:/namesadirectory.

Pleasesendusyourcommentaboutthispage

Page 489: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-file-systime

Returnslastmodificationtimeofthespecifiedfile

(vl-file-systimefilename)

Arguments

filename

Astringcontainingthenameofthefiletobechecked.

ReturnValues

Alistcontainingthemodificationdateandtime;otherwisenil,ifthefileisnotfound.

Thelistreturnedcontainsthefollowingelements:

year

month

dayofweek

dayofmonth

hours

minutes

seconds

NotethatMondayisday1ofdayofweek,Tuesdayisday2,andsoon.

Examples

_$(vl-file-systime

Page 490: less than or equalAutoLISP Functions

"c:/programfiles/<AutoCADinstallation

directory>/sample/visuallisp/yinyang.lsp")(199843810652)

Thereturnedvalueshowsthatthefilewaslastmodifiedin1998,inthe4thmonthoftheyear(April),the3rddayoftheweek(Wednesday),onthe8thdayofthemonth,at10:6:52.

Pleasesendusyourcommentaboutthispage

Page 491: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-filename-base

Returnsthenameofafile,afterstrippingoutthedirectorypathandextension

(vl-filename-basefilename)

Arguments

filename

Astringcontainingafilename.Thevl-filename-basefunctiondoesnotchecktoseeifthefileexists.

ReturnValues

Astringcontainingfilenameinuppercase,withanydirectoryandextensionstrippedfromthename.

Examples

_$(vl-filename-base"c:\\acadwin\\acad.exe")"ACAD"

_$(vl-filename-base"c:\\acadwin")"ACADWIN"

Pleasesendusyourcommentaboutthispage

Page 492: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-filename-directory

Returnsthedirectorypathofafile,afterstrippingoutthenameandextension

(vl-filename-directoryfilename)

Arguments

filename

Astringcontainingacompletefilename,includingthepath.Thevl-filename-directoryfunctiondoesnotchecktoseeifthespecifiedfileexists.Slashes(/)andbackslashes(\)areacceptedasdirectorydelimiters.

ReturnValues

Astringcontainingthedirectoryportionoffilename,inuppercase.

Examples

_$(vl-filename-directory

"c:\\acadwin\\acad.exe")"C:\\ACADWIN"

_$(vl-filename-directory

"acad.exe")""

Pleasesendusyourcommentaboutthispage

Page 493: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-filename-extension

Returnstheextensionfromafilename,afterstrippingouttherestofthename

(vl-filename-extensionfilename)

Arguments

filename

Astringcontainingafilename,includingtheextension.Thevl-filename-extensionfunctiondoesnotchecktoseeifthespecifiedfileexists.

ReturnValues

Astringcontainingtheextensionoffilename.Thereturnedstringstartswithaperiod(.)andisinuppercase.Iffilenamedoesnotcontainanextension,vl-filename-extensionreturnsnil.

Examples

_$(vl-filename-extension

"c:\\acadwin\\acad.exe")".EXE"

_$(vl-filename-extension

"c:\\acadwin\\acad")nil

Pleasesendusyourcommentaboutthispage

Page 494: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-filename-mktemp

Calculatesauniquefilenametobeusedforatemporaryfile

(vl-filename-mktemp[patterndirectoryextension])

Arguments

pattern

Astringcontainingafilenamepattern;ifnilorabsent,vl-filename-mktempuses“$VL~~”.

directory

Astringnamingthedirectoryfortemporaryfiles;ifnilorabsent,vl-filename-mktempchoosesadirectoryinthefollowingorder:

Thedirectoryspecifiedinpattern,ifany.

ThedirectoryspecifiedintheTMPenvironmentvariable.

ThedirectoryspecifiedintheTEMPenvironmentvariable.

Thecurrentdirectory.

extension

Astringnamingtheextensiontobeassignedtothefile;ifnilorabsent,vl-filename-mktempusestheextensionpartofpattern(whichmaybeanemptystring).

ReturnValues

Astringcontainingafilename,inthefollowingformat:

directory\base<XXX><.extension>

Page 495: less than or equalAutoLISP Functions

where:

baseisupto5characters,takenfrompattern

XXXisa3-characteruniquecombination

Allfilenamesgeneratedbyvl-filename-mktempduringaVLISPsessionaredeletedwhenyouexitVLISP.

Examples

_$(vl-filename-mktemp)"C:\\TMP\\$VL~~004"

_$(vl-filename-mktemp"myapp.del")"C:\\TMP\\MYAPP005.DEL"

_$(vl-filename-mktemp"c:\\acadwin\\myapp.del")"C:\\ACADWIN\\MYAPP006.DEL"

_$(vl-filename-mktemp"c:\\acadwin\\myapp.del")"C:\\ACADWIN\\MYAPP007.DEL"

_$(vl-filename-mktemp"myapp"

"c:\\acadwin")"C:\\ACADWIN\\MYAPP008"

_$(vl-filename-mktemp"myapp"

"c:\\acadwin"".del")"C:\\ACADWIN\\MYAPP00A.DEL"

Pleasesendusyourcommentaboutthispage

Page 496: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-get-resource

Returnsthetextstoredina.txtfilepackagedinaVLX

(vl-get-resourcetext-file)

Arguments

text-file

Astringnaminga.txtfilepackagedwiththeVLX.Donotincludethe.txtextensionwhenspecifyingthefilename.

ReturnValues

Astringcontainingthetextintext-file.

Examples

Assumethegetres.vlxfilecontainsaLISPprogramdefiningafunctionnamedprint-readme,andatextfilenamedreadme.txt.Theprint-readmefunctionisdefinedasfollows:

(defunprint-readme()

(princ(vl-get-resource"readme"))

(princ)

)

Afterloadinggetres.vlx,invokeprint-readme:

_$(print-readme)ProductReadmetext

ProductReadmetext2

Pleasesendusyourcommentaboutthispage

Page 497: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-list*

Constructsandreturnsalist

(vl-list*object[object]...)

Arguments

object

AnyLISPobject.

ReturnValues

Thevl-list*functionissimilartolist,butitwillplacethelastobjectinthefinalcdroftheresultlist.Ifthelastargumenttovl-list*isanatom,theresultisadottedlist.Ifthelastargumentisalist,itselementsareappendedtoallpreviousargumentsaddedtotheconstructedlist.Thepossiblereturnvaluesfromvl-list*are

Anatom,ifasingleatomobjectisspecified.

Adottedpair,ifallobjectargumentsareatoms.

Adottedlist,ifthelastargumentisanatomandneitherofthepreviousconditionsistrue.

Alist,ifnoneofthepreviousstatementsistrue.

Examples

_$(vl-list*1)1

_$(vl-list*0"text")(0."TEXT")

_$(vl-list*123)(12.3)

Page 498: less than or equalAutoLISP Functions

_$(vl-list*12'(34))(1234)

SeeAlsoThelistfunction.

Pleasesendusyourcommentaboutthispage

Page 499: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-list->string

Combinesthecharactersassociatedwithalistofintegersintoastring

(vl-list->stringchar-codes-list)

Arguments

char-codes-list

Alistofnon-negativeintegers.Eachintegermustbelessthan256.

ReturnValues

Astringofcharacters,witheachcharacterbasedononeoftheintegerssuppliedinchar-codes-list.

Examples

_$(vl-list->stringnil)""

_$(vl-list->string'(49

50))"12"

SeeAlsoThevl-string->listfunction.

Pleasesendusyourcommentaboutthispage

Page 500: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-list-exported-functions

Listsexportedfunctions

(vl-list-exported-functions[appname])

Arguments

appname

AstringnamingaloadedVLXapplication.Donotincludethe.vlxextension.

ReturnValues

Alistofstringsnamingexportedfunctions;otherwisenil,iftherearenofunctionsexportedfromthespecifiedVLX.Ifappnameisomittedorisnil,vl-list-exported-functionsreturnsalistofallexportedfunctions(forexample,c:functions)exceptthoseexportedfromVLXnamespaces.

Examples

_$(vl-list-exported-functions

"whichexpns")("WHICHNAMESPACE")

SeeAlsoThevl-list-loaded-vlxfunction.

Pleasesendusyourcommentaboutthispage

Page 501: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-list-length

Calculateslistlengthofatruelist

(vl-list-lengthlist-or-cons-object)

Arguments

list-or-cons-object

Atrueordottedlist.

ReturnValues

Anintegercontainingthelistlengthiftheargumentisatruelist;otherwiseniliflist-or-cons-objectisadottedlist.

Compatibilitynote:Thevl-list-lengthfunctionreturnsnilforadottedlist,whilethecorrespondingCommonLISPfunctionissuesanerrormessageiftheargumentisadottedlist.

Examples

_$(vl-list-lengthnil)0

_$(vl-list-length'(12))2

_$(vl-list-length'(12

.3))nil

SeeAlsoThelistpfunction.

Page 502: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 503: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-list-loaded-vlx

Returnsalistofallseparate-namespaceVLXfilesassociatedwiththecurrentdocument

(vl-list-loaded-vlx)

ReturnValues

Alistofsymbolsidentifyingseparate-namespaceVLXapplicationsassociatedwiththecurrentAutoCADdocument;otherwisenil,iftherearenoVLXapplicationsassociatedwiththecurrentdocument.

Thevl-list-loaded-vlxfunctiondoesnotidentifyVLXapplicationsthatareloadedinthecurrentdocument'snamespace.

Examples

TestforloadedVLXfilesassociatedwiththecurrentAutoCADdocument:

_$(vl-list-loaded-vlx)nil

NoVLXfilesareassociatedwiththecurrentdocument.

LoadtwoVLXfiles;bothVLXapplicationshavebeencompiledtorunintheirownnamespace:

_$(load"c:/mydocuments/visual

lisp/examples/foo1.vlx")nil

_$(load"c:/mydocuments/visual

lisp/examples/foo2.vlx")nil

TestforloadedVLXfilesassociatedwiththecurrentAutoCADdocument:

Page 504: less than or equalAutoLISP Functions

_$(vl-list-loaded-vlx)(FOO1FOO2)

ThetwoVLXfilesjustloadedareidentifiedbyvl-list-loaded-vlx.

LoadaVLXthatwascompiledtoruninadocument'snamespace:

_$(load"c:/mydocuments/visual

lisp/examples/foolocal.vlx")nil

TestforloadedVLXfiles:

_$(vl-list-loaded-vlx)(FOO1FOO2))

ThelastVLXloaded(foolocal.vlx)isnotreturnedbyvl-list-loaded-vlxbecausetheapplicationwasloadedintothedocument'snamespace;theVLXdoesnothaveitsownnamespace.

Pleasesendusyourcommentaboutthispage

Page 505: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-load-all

LoadsafileintoallopenAutoCADdocuments,andintoanydocumentsubsequentlyopenedduringthecurrentAutoCADsession

(vl-load-allfilename)

Arguments

filename

Astringnamingthefiletobeloaded.IfthefileisintheAutoCADsupportfilesearchpath,youcanomitthepathname,butyoumustalwaysspecifythefileextension;vl-load-alldoesnotassumeafiletype.

ReturnValues

Unspecified.Iffilenameisnotfound,vl-load-allissuesanerrormessage.

Examples

_$(vl-load-all"c:/mydocuments/visual

lisp/examples/whichns.lsp")nil

_$(vl-load-all"yinyang.lsp")nil

Pleasesendusyourcommentaboutthispage

Page 506: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-load-com

LoadsVisualLISPextensionstoAutoLISP

(vl-load-com)

ThisfunctionloadstheextendedAutoLISPfunctionsprovidedwithVisualLISP.TheVisualLISPextensionsimplementActiveXandAutoCADreactorsupportthroughAutoLISP,andalsoprovideActiveXutilityanddataconversionfunctions,dictionaryhandlingfunctions,andcurvemeasurementfunctions.

Iftheextensionsarealreadyloaded,vl-load-comdoesnothing.

ReturnValues

Unspecified.

SeeAlsoTheloadfunction.TheUsingExtendedAutoLISPFunctionstopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 507: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-load-reactors

Loadsreactorsupportfunctions

(vl-load-reactors)

Thisfunctionisidenticaltovl-load-comandismaintainedforbackwardcompatibility.

SeeAlsoThevl-load-comfunction.

Pleasesendusyourcommentaboutthispage

Page 508: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-mkdir

Createsadirectory

(vl-mkdirdirectoryname)

Arguments

directoryname

Thenameofthedirectoryyouwanttocreate.

ReturnValues

Tifsuccessful,nilifthedirectoryexistsorifunsuccessful.

Examples

Createadirectorynamedmydirectory:

_$(vl-mkdir"c:\\mydirectory”)T

Pleasesendusyourcommentaboutthispage

Page 509: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-member-if

Determinesifthepredicateistrueforoneofthelistmembers

(vl-member-ifpredicate-functionlist)

Thevl-member-iffunctionpasseseachelementinlisttothefunctionspecifiedinpredicate-function.Ifpredicate-functionreturnsanon-nilvalue,vl-member-ifreturnstherestofthelistinthesamemannerasthememberfunction.

Arguments

predicate-function

Thetestfunction.ThiscanbeanyfunctionthatacceptsasingleargumentandreturnsTforanyuser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

ReturnValues

Alist,startingwiththefirstelementthatpassesthetestandcontainingallelementsfollowingthisintheoriginalargument.Ifnoneoftheelementspassesthetestcondition,vl-member-ifreturnsnil.

Examples

Page 510: less than or equalAutoLISP Functions

Thefollowingcommanddrawsaline:

_$(COMMAND"_.LINE"'(0

10)'(3050)nil)nil

Thefollowingcommandusesvl-member-iftoreturnassociationlistsdescribinganentity,iftheentityisaline:

_$(vl-member-if

'(lambda(x)(=(cdrx)

"AcDbLine"))

(entget(entlast)))((100."AcDbLine")(100.010.00.0)(1130.050.00.0)(2100.00.01.0))

SeeAlsoThevl-member-if-notfunction.

Pleasesendusyourcommentaboutthispage

Page 511: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-member-if-not

Determinesifthepredicateisnilforoneofthelistmembers

(vl-member-if-notpredicate-functionlist)

Thevl-member-if-notfunctionpasseseachelementinlisttothefunctionspecifiedinpredicate-function.Ifthefunctionreturnsnil,vl-member-if-notreturnstherestofthelistinthesamemannerasthememberfunction.

Arguments

predicate-function

Thetestfunction.ThiscanbeanyfunctionthatacceptsasingleargumentandreturnsTforanyuser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

ReturnValues

Alist,startingwiththefirstelementthatfailsthetestandcontainingallelementsfollowingthisintheoriginalargument.Ifnoneoftheelementsfailsthetestcondition,vl-member-if-notreturnsnil.

Examples

_$(vl-member-if-not'atom

Page 512: less than or equalAutoLISP Functions

'(1"Str"(0."line")nilt))((0."line")nilT)

SeeAlsoThevl-member-iffunction.

Pleasesendusyourcommentaboutthispage

Page 513: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-position

Returnstheindexofthespecifiedlistitem

(vl-positionsymbol

list)

Arguments

symbol

AnyAutoLISPsymbol.

list

Atruelist.

ReturnValues

Anintegercontainingtheindexpositionofsymbolinlist;otherwisenilifsymboldoesnotexistinthelist.

Notethatthefirstlistelementisindex0,thesecondelementisindex1,andsoon.

Examples

_$(setqstuff(list"a"

"b""c""d""e"))("a""b""c""d""e")

_$(vl-position"c"stuff)2

Pleasesendusyourcommentaboutthispage

Page 514: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-prin1-to-string

ReturnsthestringrepresentationofLISPdataasifitwereoutputbytheprin1function

(vl-prin1-to-stringdata)

Arguments

data

AnyAutoLISPdata.

ReturnValues

Astringcontainingtheprintedrepresentationofdataasifdisplayedbyprin1.

Examples

_$(vl-prin1-to-string"abc")"\"abc\""

_$(vl-prin1-to-string"c:\\acadwin")"\"C:\\\\ACADWIN\""

_$(vl-prin1-to-string'my-var)"MY-VAR"

SeeAlsoThevl-princ-to-stringfunction.

Pleasesendusyourcommentaboutthispage

Page 515: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-princ-to-string

ReturnsthestringrepresentationofLISPdataasifitwereoutputbytheprincfunction

(vl-princ-to-stringdata)

Arguments

data

AnyAutoLISPdata.

ReturnValues

Astringcontainingtheprintedrepresentationofdataasifdisplayedbyprinc.

Examples

_$(vl-princ-to-string"abc")"abc"

_$(vl-princ-to-string"c:\\acadwin")"C:\\ACADWIN"

_$(vl-princ-to-string'my-var)"MY-VAR"

SeeAlsoThevl-prin1-to-stringfunction.

Pleasesendusyourcommentaboutthispage

Page 516: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-propagate

Copiesthevalueofavariableintoallopendocumentnamespaces(andsetsitsvalueinanysubsequentdrawingsopenedduringthecurrentAutoCADsession)

(vl-propagate'symbol)

Arguments

symbol

AsymbolnaminganAutoLISPvariable.

ReturnValues

Unspecified.

ExamplesCommand:(vl-propagate'radius)

nil

Pleasesendusyourcommentaboutthispage

Page 517: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-registry-delete

DeletesthespecifiedkeyorvaluefromtheWindowsregistry

(vl-registry-deletereg-key[val-name])

Arguments

reg-key

AstringspecifyingaWindowsregistrykey.

val-name

Astringcontainingthevalueofthereg-keyentry.

Ifval-nameissuppliedandisnotnil,thespecifiedvaluewillbepurgedfromtheregistry.Ifval-nameisabsentornil,thefunctiondeletesthespecifiedkeyandallofitsvalues.

ReturnValues

Tifsuccessful;otherwisenil.

Examples

_$(vl-registry-write"HKEY_CURRENT_USER\\Test"

"""testdata")"testdata"

_$(vl-registry-read"HKEY_CURRENT_USER\\Test")"testdata"

_$(vl-registry-delete"HKEY_CURRENT_USER\\Test")T

Note Thisfunctioncannotdeleteakeythathassubkeys.Todeleteasubkeyyoumustusevl-registry-descendentstoenumerateallsubkeysanddeleteallofthem.

Page 518: less than or equalAutoLISP Functions

SeeAlsoThevl-registry-descendents,vl-registry-read,andvl-registry-writefunctions.

Pleasesendusyourcommentaboutthispage

Page 519: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-registry-descendents

Returnsalistofsubkeysorvaluenamesforthespecifiedregistrykey

(vl-registry-descendentsreg-key[val-names])

Arguments

reg-key

AstringspecifyingaWindowsregistrykey.

val-names

Astringcontainingthevaluesforthereg-keyentry.

Ifval-namesissuppliedandisnotnil,thespecifiedvaluenameswillbelistedfromtheregistry.Ifval-nameisabsentornil,thefunctiondisplaysallsubkeysofreg-key.

ReturnValues

Alistofstrings,ifsuccessful;otherwisenil.

Examples

_$(vl-registry-descendents

"HKEY_LOCAL_MACHINE\\SOFTWARE")("Description""ProgramGroups""ORACLE""ODBC""Netscape""Microsoft")

SeeAlsoThevl-registry-delete,vl-registry-read,andvl-registry-writefunctions.

Page 520: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 521: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-registry-read

ReturnsdatastoredintheWindowsregistryforthespecifiedkey/valuepair

(vl-registry-readreg-key[val-name])

Arguments

reg-key

AstringspecifyingaWindowsregistrykey.

val-name

Astringcontainingthevalueofaregistryentry.

Ifval-nameissuppliedandisnotnil,thespecifiedvaluewillbereadfromtheregistry.Ifval-nameisabsentornil,thefunctionreadsthespecifiedkeyandallofitsvalues.

ReturnValues

Astringcontainingregistrydata,ifsuccessful;otherwisenil.

Examples

_$(vl-registry-read

"HKEY_CURRENT_USER\\Test")nil

_$(vl-registry-write"HKEY_CURRENT_USER\\Test"

"""testdata")"testdata"

_$(vl-registry-read

"HKEY_CURRENT_USER\\Test")"testdata"

Page 522: less than or equalAutoLISP Functions

SeeAlsoThevl-registry-delete,vl-registry-descendents,andvl-registry-writefunctions.

Pleasesendusyourcommentaboutthispage

Page 523: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-registry-write

CreatesakeyintheWindowsregistry

(vl-registry-writereg-key[val-nameval-data])

Arguments

reg-key

AstringspecifyingaWindowsregistrykey.

Note Youcannotusevl-registry-writeforHKEY_USERSorKEY_LOCAL_MACHINE.

val-name

Astringcontainingthevalueofaregistryentry.

val-data

Astringcontainingregistrydata.

Ifval-nameisnotsuppliedorisnil,adefaultvalueforthekeyiswritten.Ifval-nameissuppliedandval-dataisnotspecified,anemptystringisstored.

ReturnValues

vl-registry-writereturnsval-data,ifsuccessful;otherwisenil.

Examples

_$(vl-registry-write"HKEY_CURRENT_USER\\Test"

"""testdata")"testdata"

_$(vl-registry-read

"HKEY_CURRENT_USER\\Test")"testdata"

Page 524: less than or equalAutoLISP Functions

SeeAlsoThevl-registry-delete,vl-registry-descendents,andvl-registry-readfunctions.

Pleasesendusyourcommentaboutthispage

Page 525: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-remove

Removeselementsfromalist

(vl-removeelement-to-removelist)

Arguments

element-to-remove

Thevalueoftheelementtoberemoved;maybeanyLISPdatatype.

list

Anylist.

ReturnValues

Thelistwithallelementsexceptthoseequaltoelement-to-remove.

Examples

_$(vl-removepi(listpi

t0"abc"))(T0"abc")

Pleasesendusyourcommentaboutthispage

Page 526: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-remove-if

Returnsallelementsofthesuppliedlistthatfailthetestfunction

(vl-remove-ifpredicate-functionlist)

Arguments

predicate-function

Thetestfunction.ThiscanbeanyfunctionthatacceptsasingleargumentandreturnsTforanyuser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

ReturnValues

Alistcontainingallelementsoflistforwhichpredicate-functionreturnsnil.

Examples

_$(vl-remove-if'vl-symbolp

(listpit0"abc"))(3.141590"abc")

Pleasesendusyourcommentaboutthispage

Page 527: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-remove-if-not

Returnsallelementsofthesuppliedlistthatpassthetestfunction

(vl-remove-if-notpredicate-functionlist)

Arguments

predicate-function

Thetestfunction.ThiscanbeanyfunctionthatacceptsasingleargumentandreturnsTforanyuser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

ReturnValues

Alistcontainingallelementsoflistforwhichpredicate-functionreturnsanon-nilvalue

Examples

_$(vl-remove-if-not'vl-symbolp

(listpit0"abc"))(T)

Pleasesendusyourcommentaboutthispage

Page 528: less than or equalAutoLISP Functions
Page 529: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-some

Checkswhetherthepredicateisnotnilforoneelementcombination

(vl-somepredicate-functionlist[list]...)

Arguments

predicate-function

Thetestfunction.Thiscanbeanyfunctionthatacceptsasmanyargumentsastherearelistsprovidedwithvl-some,andreturnsTonauser-specifiedcondition.Thepredicate-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

list

Alisttobetested.

Thevl-somefunctionpassesthefirstelementofeachsuppliedlistasanargumenttothetestfunction,thenthenextelementfromeachlist,andsoon.Evaluationstopsassoonasthepredicatefunctionreturnsanon-nilvalueforanargumentcombination,oruntilallelementshavebeenprocessedinoneofthelists.

ReturnValues

Thepredicatevalue,ifpredicate-functionreturnedavalueotherthannil;otherwisenil.

Examples

Page 530: less than or equalAutoLISP Functions

Thefollowingexamplecheckswhethernlst(anumberlist)hasequalelementsinsequence:

_$(setqnlst(list02pi

pi4))(023.141593.141594)

_$(vl-some'=nlst(cdr

nlst))T

Pleasesendusyourcommentaboutthispage

Page 531: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-sort

Sortstheelementsinalistaccordingtoagivencomparefunction

(vl-sortlistcomparison-function)

Arguments

list

Anylist.

comparison-function

Acomparisonfunction.ThiscanbeanyfunctionthatacceptstwoargumentsandreturnsT(oranynon-nilvalue)ifthefirstargumentprecedesthesecondinthesortorder.Thecomparison-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

ReturnValues

Alistcontainingtheelementsoflistintheorderspecifiedbycomparison-function.Duplicateelementsmaybeeliminatedfromthelist.

Examples

Sortalistofnumbers:

_$(vl-sort'(3213)'<)(123);

Notethattheresultlistcontainsonlyone3.

Page 532: less than or equalAutoLISP Functions

Sortalistof2DpointsbyYcoordinate:

_$(vl-sort'((13)(22)

(31))

(function

(lambda(e1e2)

(<(cadre1)(cadre2)))))((31)(22)(13))

Sortalistofsymbols:

_$(vl-sort

'(adcba)

'(lambda(s1s2)

(<(vl-symbol-name

s1)(vl-symbol-names2))))(ABCD);NotethatonlyoneAremainsintheresultlist

Pleasesendusyourcommentaboutthispage

Page 533: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-sort-i

Sortstheelementsinalistaccordingtoagivencomparefunction,andreturnstheelementindexnumbers

(vl-sort-ilistcomparison-function)

Arguments

list

Anylist.

comparison-function

Acomparisonfunction.ThiscanbeanyfunctionthatacceptstwoargumentsandreturnsT(oranynon-nilvalue)ifthefirstargumentprecedesthesecondinthesortorder.Thecomparison-functionvaluecantakeoneofthefollowingforms:

Asymbol(functionname)

'(LAMBDA(A1A2)...)

(FUNCTION(LAMBDA(A1A2)...))

ReturnValues

Alistcontainingtheindexvaluesoftheelementsoflist,sortedintheorderspecifiedbycomparison-function.Duplicateelementswillberetainedintheresult.

Examples

Sortalistofcharactersindescendingorder:

_$(vl-sort-i'("a""d""f"

Page 534: less than or equalAutoLISP Functions

"c")'>)(2130)

Thesortedlistorderis“f”“d”“c”“a”;“f”isthe3rdelement(index2)intheoriginallist,“d”isthe2ndelement(index1)inthelist,andsoon.

Sortalistofnumbersinascendingorder:

_$(vl-sort-i'(3213)

'<)(2130)

Notethatbothoccurrencesof3areaccountedforintheresultlist.

Sortalistof2DpointsbyYcoordinate:

_$(vl-sort-i'((13)(2

2)(31))

(function(lambda

(e1e2)

(<

(cadre1)(cadre2)))))(210)

Sortalistofsymbols:

_$(vl-sort-i

'(adcba)

'(lambda(s1s2)

(<(vl-symbol-name

s1)(vl-symbol-names2))))(40321)

Notethatbotha'sareaccountedforintheresultlist.

Pleasesendusyourcommentaboutthispage

Page 535: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string->list

Convertsastringintoalistofcharactercodes

(vl-string->liststring)

Arguments

string

Astring.

ReturnValues

Alist,eachelementofwhichisanintegerrepresentingthecharactercodeofthecorrespondingcharacterinstring.

Examples

_$(vl-string->list"")nil

_$(vl-string->list"12")(4950)

SeeAlsoThevl-list->stringfunction.

Pleasesendusyourcommentaboutthispage

Page 536: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-elt

ReturnstheASCIIrepresentationofthecharacterataspecifiedpositioninastring

(vl-string-eltstringposition)

Arguments

string

Astringtobeinspected.

position

Adisplacementinthestring;thefirstcharacterisdisplacement0.Notethatanerroroccursifpositionisoutsidetherangeofthestring.

ReturnValues

AnintegerdenotingtheASCIIrepresentationofthecharacteratthespecifiedposition.

Examples

_$(vl-string-elt"Maythe

Forcebewithyou"8)70

Pleasesendusyourcommentaboutthispage

Page 537: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-left-trim

Removesthespecifiedcharactersfromthebeginningofastring

(vl-string-left-trimcharacter-setstring)

Arguments

character-set

Astringlistingthecharacterstoberemoved.

string

Thestringtobestrippedofcharacter-set.

ReturnValues

Astringcontainingasubstringofstringwithallleadingcharactersincharacter-setremoved

Examples

_$(vl-string-left-trim"

\t\n""\n\tSTR")"STR"

_$(vl-string-left-trim"12456789"

"12463CPOisnotR2D2")"3CPOisnotR2D2"

_$(vl-string-left-trim"

""Therearetoomanyspaceshere")"Therearetoomanyspaceshere"

Pleasesendusyourcommentaboutthispage

Page 538: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-mismatch

Returnsthelengthofthelongestcommonprefixfortwostrings,startingatspecifiedpositions

(vl-string-mismatchstr1str2[pos1pos2ignore-case-p])

Arguments

str1

Thefirststringtobematched.

str2

Thesecondstringtobematched.

pos1

Anintegeridentifyingthepositiontosearchfrominthefirststring;0ifomitted.

pos2

Anintegeridentifyingthepositiontosearchfrominthesecondstring;0ifomitted.

ignore-case-p

IfTisspecifiedforthisargument,caseisignored;otherwise,caseisconsidered.

ReturnValues

Aninteger.

Examples

Page 539: less than or equalAutoLISP Functions

_$(vl-string-mismatch"VL-FUN"

"VL-VAR")3

_$(vl-string-mismatch"vl-fun"

"avl-var")0

_$(vl-string-mismatch"vl-fun"

"avl-var"01)3

_$(vl-string-mismatch"VL-FUN"

"Vl-vAR")1

_$(vl-string-mismatch"VL-FUN"

"Vl-vAR"00T)3

Pleasesendusyourcommentaboutthispage

Page 540: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-position

LooksforacharacterwiththespecifiedASCIIcodeinastring

(vl-string-positionchar-codestr[start-pos[from-end-p]])

Arguments

char-code

Theintegerrepresentationofthecharactertobesearched.

str

Thestringtobesearched.

start-pos

Thepositiontobeginsearchingfrominthestring(firstcharacteris0);0ifomitted.

from-end-p

IfTisspecifiedforthisargument,thesearchbeginsattheendofthestringandcontinuesbackwardtopos.

ReturnValues

Anintegerrepresentingthedisplacementatwhichchar-codewasfoundfromthebeginningofthestring;nilifthecharacterwasnotfound.

Examples

_$(vl-string-position(ascii

"z")"azbdc")1

_$(vl-string-position122

"azbzc")

Page 541: less than or equalAutoLISP Functions

1

_$(vl-string-position(ascii

"x")"azbzc")nil

Thesearchstringusedinthefollowingexamplecontainstwo“z”characters.Readingfromlefttoright,withthefirstcharacterbeingdisplacement0,thereisonezatdisplacement1andanotherzatdisplacement3:

_$(vl-string-position(ascii

"z")"azbzlmnqc")1

Searchingfromlefttoright(thedefault),the“z”inposition1isthefirstonevl-string-positionencounters.Butwhensearchingfromrighttoleft,asinthefollowingexample,the“z”inposition3isthefirstoneencountered:

_$(vl-string-position(ascii

"z")"azbzlmnqc"nilt)3

Pleasesendusyourcommentaboutthispage

Page 542: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-right-trim

Removesthespecifiedcharactersfromtheendofastring

(vl-string-right-trimcharacter-setstring)

Arguments

character-set

Astringlistingthecharacterstoberemoved.

string

Thestringtobestrippedofcharacter-set.

ReturnValues

Astringcontainingasubstringofstringwithalltrailingcharactersincharacter-setremoved.

Examples

_$(vl-string-right-trim

"\t\n""STR\n\t")"STR"

_$(vl-string-right-trim

"1356789""3CPOisnotR2D267891")"3CPOisnotR2D2"

_$(vl-string-right-trim

"""Therearetoomanyspaceshere")"Therearetoomanyspaceshere"

Pleasesendusyourcommentaboutthispage

Page 543: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-search

Searchesforthespecifiedpatterninastring

(vl-string-searchpatternstring[start-pos])

Arguments

pattern

Astringcontainingthepatterntobesearchedfor.

string

Thestringtobesearchedforpattern.

start-pos

Anintegeridentifyingthestartingpositionofthesearch;0ifomitted.

ReturnValues

Anintegerrepresentingthepositioninthestringwherethespecifiedpatternwasfound;otherwisenilifthepatternisnotfound;thefirstcharacterofthestringisposition0.

Examples

_$(vl-string-search"foo"

"pfooyeyonyou")1

_$(vl-string-search"who"

"pfooyeyonyou")nil

_$(vl-string-search"foo"

"fooey-more-fooey"1)11

Page 544: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 545: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-subst

Substitutesonestringforanother,withinastring

(vl-string-substnew-strpatternstring[start-pos])

Arguments

new-str

Thestringtobesubstitutedforpattern.

pattern

Astringcontainingthepatterntobereplaced.

string

Thestringtobesearchedforpattern.

start-pos

Anintegeridentifyingthestartingpositionofthesearch;0ifomitted.

Notethatthesearchiscase-sensitive,andthatvl-string-substsubstitutesonlythefirstoccurrenceitfindsofthestring.

ReturnValues

Thevalueofstringafteranysubstitutionshavebeenmade.

Examples

Replacethestring“Ben”with“Obi-wan”:

_$(vl-string-subst"Obi-wan"

"Ben""BenKenobi")"Obi-wanKenobi"

Page 546: less than or equalAutoLISP Functions

Replace“Ben”with“Obi-wan”:

_$(vl-string-subst"Obi-wan"

"Ben""benKenobi")"benKenobi"

Nothingwassubstitutedbecausevl-string-substdidnotfindamatchfor“Ben”;the“ben”inthestringthatwassearchedbeginswithalowercase“b”.

Replace“Ben”with“Obi-wan”:

_$(vl-string-subst"Obi-wan"

"Ben""BenKenobiBen")"Obi-wanKenobiBen"

Notethattherearetwooccurrencesof“Ben”inthestringthatwassearched,butvl-string-substreplacesonlythefirstoccurrence.

Replace“Ben”with“Obi-wan,”butstartthesearchatthefourthcharacterinthestring:

_$(vl-string-subst"Obi-wan"

"Ben""Ben\"Ben\"Kenobi"3)"Ben\"Obi-wan\"Kenobi"

Therearetwooccurrencesof“Ben”inthestringthatwassearched,butbecausevl-string-substwasinstructedtobeginsearchingatthefourthcharacter,itfoundandreplacedthesecondoccurrence,notthefirst.

Pleasesendusyourcommentaboutthispage

Page 547: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-translate

Replacescharactersinastringwithaspecifiedsetofcharacters

(vl-string-translatesource-setdest-setstr)

Arguments

source-set

Astringofcharacterstobematched.

dest-set

Astringofcharacterstobesubstitutedforthoseinsource-set.

str

Astringtobesearchedandtranslated.

ReturnValues

Thevalueofstrafteranysubstitutionshavebeenmade

Examples

_$(vl-string-translate"abcABC"

"123123""Aisa,Bisb,CisC")"1is1,2is2,3is3"

_$(vl-string-translate"abc"

"123""Aisa,Bisb,CisC")"Ais1,Bis2,Cis3"

Pleasesendusyourcommentaboutthispage

Page 548: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-string-trim

Removesthespecifiedcharactersfromthebeginningandendofastring

(vl-string-trimchar-setstr)

Arguments

char-set

Astringlistingthecharacterstoberemoved.

str

Thestringtobetrimmedofchar-set.

ReturnValues

Thevalueofstr,afteranycharactershavebeentrimmed.

Examples

_$(vl-string-trim"\t\n"

"\t\nSTR\n\t")"STR"

_$(vl-string-trim"this

isjunk""thisisjunkDon'tcallthisjunk!thisisjunk")"Don'tcallthisjunk!"

_$(vl-string-trim"""

Leavemealone")"Leavemealone"

Pleasesendusyourcommentaboutthispage

Page 549: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-symbol-name

Returnsastringcontainingthenameofasymbol

(vl-symbol-namesymbol)

Arguments

symbol

AnyLISPsymbol.

ReturnValues

Astringcontainingthenameofthesuppliedsymbolargument,inuppercase.

Examples

_$(vl-symbol-name'S::STARTUP)"S::STARTUP"

_$(progn(setqsym'my-var)

(vl-symbol-namesym))"MY-VAR"

_$(vl-symbol-name1);***ERROR:badargumenttype:symbolp1

Pleasesendusyourcommentaboutthispage

Page 550: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-symbol-value

Returnsthecurrentvalueboundtoasymbol

(vl-symbol-valuesymbol)

Thisfunctionisequivalenttotheevalfunction,butdoesnotcalltheLISPevaluator.

Arguments

symbol

AnyLISPsymbol.

ReturnValues

Thevalueofsymbol,afterevaluation.

Examples

_$(vl-symbol-value't)T

_$(vl-symbol-value'PI)3.14159

_$(progn(setqsym'PAUSE)

(vl-symbol-valuesym))"\\"

Pleasesendusyourcommentaboutthispage

Page 551: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-symbolp

Identifieswhetherornotaspecifiedobjectisasymbol

Arguments

(vl-symbolpobject)

object

AnyLISPobject.

ReturnValues

Tifobjectisasymbol;otherwisenil.

Examples

_$(vl-symbolpt)T

_$(vl-symbolpnil)nil

_$(vl-symbolp1)nil

_$(vl-symbolp(list1))nil

Pleasesendusyourcommentaboutthispage

Page 552: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-unload-vlx

UnloadaVLXapplicationthatisloadedinitsownnamespace

(vl-unload-vlxappname)

Arguments

appname

AstringnamingaVLXapplicationthatisloadedinitsownnamespace.Donotincludethe.vlxextension.

Thevl-unload-vlxfunctiondoesnotunloadVLXapplicationsthatareloadedinthecurrentdocument'snamespace.

ReturnValues

Tifsuccessful;otherwisevl-unload-vlxresultsinanerror.

Examples

Assumingthatvlxnsisanapplicationthatisloadedinitsownnamespace,thefollowingcommandunloadsvlxns:

Command:(vl-unload-vlx"vlxns")

T

Tryunloadingvlxnsagain:Command:(vl-unload-vlx"vlxns")

;***ERROR:LISPApplicationisnotfoundVLXNS

Thevl-unload-vlxcommandfailsthistime,becausetheapplicationwasnotloaded.

SeeAlso

Page 553: less than or equalAutoLISP Functions

Theloadandvl-vlx-loaded-pfunctions.

Pleasesendusyourcommentaboutthispage

Page 554: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-vbaload

LoadsaVBAproject

Arguments

(vl-vbaloadfilename)

filename

AstringnamingtheVBAprojectfiletobeloaded.

ReturnValues

Unspecified,ifsuccessful.

Examples

_$(vl-vbaload"c:/program

files/<AutoCADinstallationdirectory>/sample/vba/drawline.dvb")"c:\\programfiles\\<AutoCADinstallationdirectory>\\sample\\vba\\drawline.dvb"

SeeAlsoThevl-vbarunfunction.

Pleasesendusyourcommentaboutthispage

Page 555: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-vbarun

RunsaVBAmacro

Arguments

(vl-vbarunmacroname)

macroname

AstringnamingaloadedVBAmacro.

ReturnValues

macroname

Examples

LoadaVBAprojectfile:

_$(vl-vbaload"c:/program

files/<AutoCADinstallationdirectory>/sample/vba/drawline.dvb")"c:\\programfiles\\<AutoCADinstallationdirectory>\\sample\\vba\\drawline.dvb"

Runamacrofromtheloadedproject:

_$(vl-vbarun"drawline")"drawline"

SeeAlsoThevl-vbaloadfunction.

Pleasesendusyourcommentaboutthispage

Page 556: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vl-vlx-loaded-p

Determineswhetheraseparate-namespaceVLXiscurrentlyloaded

(vl-vlx-loaded-pappname)

Arguments

appname

AstringnamingaVLXapplication.

ReturnValues

Tiftheapplicationisloaded,nilifitisnotloaded.

Examples

Checktoseeifthevlxnsapplicationisloadedinitsownnamespace:Command:(vl-vlx-loaded-p"vlxns")

nil

Theapplicationisnotloadedinitsownnamespace.

Nowloadvlxns:Command:(load"vlxns.vlx")

nil

Checktoseeifthevlxnsapplicationloadedsuccessfully:Command:(vl-vlx-loaded-p"vlxns")

T

Thisexampleassumesvlxnswasdefinedtoruninitsownnamespace.Iftheapplicationwasnotdefinedtoruninitsownnamespace,itwouldloadintothecurrentdocument'snamespaceandvl-vlx-loaded-pwouldreturnnil.

Page 557: less than or equalAutoLISP Functions

SeeAlsoTheloadandvl-unload-vlxfunctions.

Pleasesendusyourcommentaboutthispage

Page 558: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-3D-point

CreatesActiveX-compatible(variant)3Dpointstructure

(vlax-3D-pointlist)or(vlax-3D-pointxy[z])

Arguments

list

Alistof2or3numbers,representingpoints.

x,y

NumbersrepresentingXandYcoordinatesofapoint.

z

AnumberrepresentingtheZcoordinateofapoint.

ReturnValues

Avariantcontainingathree-elementarrayofdoubles.

Examples

_$(vlax-3D-point520)#<variant8197...>

_$(vlax-3D-point'(33.6

44.090.0))<variant8197...>

SeeAlsoThevlax-make-safearray,vlax-make-variant,vlax-safearray-fill,andvlax-safearray-put-elementfunctions.

Page 559: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 560: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-add-cmd

AddscommandstotheAutoCADbuilt-incommandset

(vlax-add-cmdglobal-namefunc-sym[local-namecmd-flags])

Withvlax-add-cmdyoucandefineafunctionasanAutoCADcommand,withoutusingthec:prefixinthefunctionname.YoucanalsodefineatransparentAutoLISPcommand,whichisnotpossiblewithac:function.

Warning Youcannotusethecommandfunctioncallinatransparentlydefinedvlax-add-cmdfunction.DoingsocancauseAutoCADtocloseunexpectedly.

Thevlax-add-cmdfunctionmakesanAutoLISPfunctionvisibleasanObjectARX-stylecommandattheAutoCADCommandpromptduringthecurrentAutoCADsession.ThefunctionprovidesaccesstotheObjectARXacedRegCmdsmacro,whichprovidesapointertotheObjectARXsystemAcEdCommandStackobject.

Thevlax-add-cmdfunctionautomaticallyassignscommandstocommandgroups.Whenissuedfromadocumentnamespace,vlax-add-cmdaddsthecommandtoagroupnameddoc-ID;doc-IDisahexadecimalvalueidentifyingthedocument.Ifissuedfromaseparate-namespaceVLX,vlax-add-cmdaddsthecommandtoagroupnamedVLC-Ddoc-ID:VLX-name,whereVLX-nameisthenameoftheapplicationthatissuedvlax-add-cmd.

Itisrecommendedthatyouusethevlax-add-cmdfunctionfromaseparate-namespaceVLX.YoushouldthenexplicitlyloadtheVLXusingtheAPPLOADcommand,ratherthanbyplacingitinoneofthestartupLISPfiles.

Note Youcannotusevlax-add-cmdtoexposefunctionsthatcreatereactorobjectsorserveasreactorcallbacks.

Arguments

Page 561: less than or equalAutoLISP Functions

global-name

Astring.

func-sym

AsymbolnaminganAutoLISPfunctionwithzeroarguments.

local-name

Astring(defaultstoglobal-name).

cmd-flags

Aninteger(defaultstoACRX_CMD_MODAL+ACRX_CMD_REDRAW)TheprimaryflagsareACRX_CMD_MODAL(0) Commandcannotbeinvokedwhileanothercommandisactive.ACRX_CMD_TRANSPARENT(1) Commandcanbeinvokedwhileanothercommandisactive.ThesecondaryflagsareACRX_CMD_USEPICKSET(2) WhenthepickfirstsetisretrieveditisclearedwithinAutoCAD.Commandwillbeabletoretrievethepickfirstset.Commandcannotretrieveorsetgrips.ACRX_CMD_REDRAW(4) Whenthepickfirstsetorgripsetisretrieved,neitherwillbeclearedwithinAutoCAD.Commandcanretrievethepickfirstsetandthegripset.

IfbothACRX_CMD_USEPICKSETandACRX_CMD_REDRAWareset,theeffectisthesameasifjustACRX_CMD_REDRAWisset.Formoreinformationabouttheflags,seethe“CommandStack”intheObjectARXReference.

ReturnValues

Theglobal-nameargument,ifsuccessful.ThefunctionreturnsnilifacedRegCmds->addCommand(...)returnsanerrorcondition.

Examples

Thehello-autocadfunctioninthefollowingexamplehasnoc:prefix,butvlax-add-cmdmakesitvisibleasanObjectARX-stylecommandattheAutoCADCommandprompt:

Page 562: less than or equalAutoLISP Functions

_$(defunhello-autocad()

(princ"helloVisualLISP"))HELLO-AUTOCAD

_$(vlax-add-cmd"hello-autocad"

'hello-autocad)"hello-autocad"

SeeAlsoThevlax-remove-cmdfunction.

Pleasesendusyourcommentaboutthispage

Page 563: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-create-object

Createsanewinstanceofanapplicationobject

(vlax-create-objectprog-id)

Usevlax-create-objectwhenyouwantanewinstanceofanapplicationtobestarted,andanobjectofthetypespecifiedby<Component>(seetheargumentdescription)tobecreated.Tousethecurrentinstance,usevlax-get-object.However,ifanapplicationobjecthasregistereditselfasasingle-instanceobject,onlyoneinstanceoftheobjectiscreated,nomatterhowmanytimesyoucallvlax-create-object.

Arguments

prog-id

AstringcontainingtheprogrammaticidentifierofthedesiredActiveXobject.Theformatofprog-idis<Vendor>.<Component>.<Version>Forexample:AutoCAD.Drawing.15

ReturnValues

Theapplicationobject(VLA-object).

Examples

CreateaninstanceofaMicrosoftExcelapplication:

_$(vlax-create-object

"Excel.Application")#<VLA-OBJECT_Application0017b894>

Page 564: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 565: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getArea

Returnstheareainsidethecurve

(vlax-curve-getAreacurve-obj)

Arguments

curve-obj

TheVLA-objecttobemeasured.

ReturnValues

Arealnumberrepresentingtheareaofthecurve,ifsuccessful;otherwisenil.

Examples

Assumethecurvebeingmeasuredistheellipseinthefollowingdrawing:

Samplecurve(ellipse)forvlax-curve-getarea

TheellipseObjvariablepointstotheellipseVLA-object.

Thefollowingcommandobtainstheareaofthecurve:

_$(vlax-curve-getAreaellipseObj)4.712393

Pleasesendusyourcommentaboutthispage

Page 566: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getClosestPointTo

Returnsthepoint(inWCS)onacurvethatisnearesttothespecifiedpoint

(vlax-curve-getClosestPointTocurve-objgivenPnt[extend])

Arguments

curve-obj

TheVLA-objecttobemeasured.

givenPnt

Apoint(inWCS)forwhichtofindthenearestpointonthecurve.

extend

Ifspecifiedandnotnil,vlax-curve-getClosestPointToextendsthecurvewhensearchingforthenearestpoint.

ReturnValues

A3Dpointlistrepresentingapointonthecurve,ifsuccessful;otherwisenil.

Examples

Assumethatthecurvebeingmeasuredisthearcinthefollowingdrawing:

Returntheclosestpointonthearctothecoordinates6.0,0.5:

_$(vlax-curve-getClosestPointTo

arcObj'(6.00.50.0))(6.01.50.0)

Returntheclosestpointonthearctothecoordinates6.0,0.5,afterextendingthe

Page 567: less than or equalAutoLISP Functions

arc:

_$(vlax-curve-getClosestPointTo

arcObj'(6.00.50.0)T)(5.70920.6817530.0)

Pleasesendusyourcommentaboutthispage

Page 568: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getClosestPointToProjection

Returnstheclosestpoint(inWCS)onacurveafterprojectingthecurveontoaplane

(vlax-curve-getClosestPointToProjectioncurve-objgivenPntnormal[extend]

Arguments

curve-obj

TheVLA-objecttobemeasured.

givenPnt

Apoint(inWCS)forwhichtofindthenearestpointonthecurve.

normal

Anormalvector(inWCS)fortheplanetoprojectonto.

extend

Ifspecifiedandnotnil,vlax-curve-getClosestPointToProjectionextendsthecurvewhensearchingforthenearestpoint.

vlax-curve-getClosestPointToProjectionprojectsthecurveontotheplanedefinedbythegivenPntandnormal,andthencalculatesthenearestpointonthatprojectedcurvetogivenPnt.Theresultingpointisthenprojectedbackontotheoriginalcurve,andvlax-curve-getClosestPointToProjectionreturnsthatprojectedpoint.

ReturnValues

A3Dpointlistrepresentingapointonthecurve,ifsuccessful;otherwisenil.

Page 569: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 570: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getDistAtParam

Returnsthelengthofthecurve'ssegmentfromthecurve'sbeginningtothespecifiedparameter

(vlax-curve-getDistAtParamcurve-objparam)

Arguments

curve-obj

TheVLA-objecttobemeasured.

param

Anumberspecifyingaparameteronthecurve.

ReturnValues

Arealnumberthatisthelengthuptothespecifiedparameter,ifsuccessful;otherwisenil.

Examples

AssumethatsplineObjpointstothesplineinthefollowingdrawing:

Samplecurve(spline)forvlax-curve-getDistAtParam

Obtainthestartparameterofthecurve:

_$(setqstartSpline(vlax-curve-getStartParam

splineObj))0.0

Thecurvestartsatparameter0.

Page 571: less than or equalAutoLISP Functions

Obtaintheendparameterofthecurve:

_$(setqendSpline(vlax-curve-getEndParam

splineObj))17.1546

Thecurve'sendparameteris17.1546.

Determinethedistancetotheparametermidwayalongthecurve:

_$(vlax-curve-getDistAtParam

splineObj

(/(-endsplinestartspline)

2))8.99417

Thedistancefromthestarttothemiddleofthecurveis8.99417.

Pleasesendusyourcommentaboutthispage

Page 572: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getDistAtPoint

Returnsthelengthofthecurve'ssegmentbetweenthecurve'sstartpointandthespecifiedpoint

(vlax-curve-getDistAtPointcurve-objpoint)

Arguments

curve-obj

TheVLA-objecttobemeasured.

point

A3Dpointlist(inWCS)oncurve-obj.

ReturnValues

Arealnumberifsuccessful;otherwisenil.

Examples

Forthefollowingexample,assumethatsplineObjpointstothesplineshownintheexampleforvlax-curve-getDistAtParam.

SetOSNAPtotangentandselectthepointwherethelineistangenttothecurve:

_$(setqselPt(getpoint))(4.914386.047380.0)

Determinethedistancefromthestartofthecurvetotheselectedpoint:

_$(vlax-curve-getDistAtPoint

splineObjselpt)5.17769

Page 573: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 574: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getEndParam

Returnstheparameteroftheendpointofthecurve

(vlax-curve-getEndParamcurve-obj)

Arguments

curve-obj

TheVLA-objecttobemeasured.

ReturnValues

Arealnumberrepresentinganendparameter,ifsuccessful;otherwisenil.

Examples

AssumingthatellipseObjpointstotheellipseshownintheexampleforvlax-curve-getArea,thefollowingfunctioncallreturnstheendparameterofthecurve:

_$(vlax-curve-getendparam

ellipseObj)6.28319

Theendparameteris6.28319(twicepi).

SeeAlsoThevlax-curve-getStartParamfunction.

Pleasesendusyourcommentaboutthispage

Page 575: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getEndPoint

Returnstheendpoint(inWCS)ofthecurve

(vlax-curve-getEndPointcurve-obj)

Arguments

curve-obj

TheVLA-objecttobemeasured.

ReturnValues

A3Dpointlistrepresentinganendpoint,ifsuccessful;otherwisenil.

Examples

Gettheendpointoftheellipseusedtodemonstratevlax-curve-getArea:

_$(vlax-curve-getEndPoint

ellipseObj)(2.02.00.0)

Pleasesendusyourcommentaboutthispage

Page 576: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getFirstDeriv

Returnsthefirstderivative(inWCS)ofacurveatthespecifiedlocation

(vlax-curve-getFirstDerivcurve-objparam)

Arguments

curve-obj

TheVLA-objecttobemeasured.

param

Anumberspecifyingaparameteronthecurve.

ReturnValues

A3Dvectorlist,ifsuccessful;otherwisenil.

Examples

Forthefollowingexample,assumethatsplineObjpointstothesplineshownintheexampleofthevlax-curve-getDistAtParamfunction.

Obtainthestartparameterofthecurve:

_$(setqstartSpline(vlax-curve-getStartParam

splineObj))0.0

Obtaintheendparameterofthecurve:

_$(setqendSpline(vlax-curve-getEndParam

splineObj))17.1546

Page 577: less than or equalAutoLISP Functions

Determinethefirstderivativeattheparametermidwayalongthecurve:

_$(vlax-curve-getFirstDeriv

splineObj

(/(-endsplinestartspline)

2))(0.422631-1.09510.0)

Pleasesendusyourcommentaboutthispage

Page 578: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getParamAtDist

Returnstheparameterofacurveatthespecifieddistancefromthebeginningofthecurve

(vlax-curve-getParamAtDistcurve-objdist)

Arguments

curve-obj

TheVLA-objecttobemeasured.

dist

Anumberspecifyingthedistancefromthebeginningofthecurve.

ReturnValues

Arealnumberrepresentingaparameter,ifsuccessful;otherwisenil.

Examples

AssumingthatsplineObjpointstothesplineshownintheexampleforvlax-curve-getDistAtParam,determinetheparameteratadistanceof1.0fromthebeginningofthespline:

_$(vlax-curve-getParamAtDist

splineObj1.0)0.685049

Pleasesendusyourcommentaboutthispage

Page 579: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getParamAtPoint

Returnstheparameterofthecurveatthepoint

(vlax-curve-getParamAtPointcurve-objpoint)

Arguments

curve-obj

TheVLA-objecttobemeasured.

point

A3Dpointlist(inWCS)oncurve-obj.

ReturnValues

Arealnumberrepresentingaparameter,ifsuccessful;otherwisenil.

Examples

AssumingthatellipseObjpointstotheellipseshownintheexampleforvlax-curve-getArea,setOSNAPtotangentandselectthepointwherethelineistangenttotheellipse:

_$(setqselPt(getpoint))(7.557655.550660.0)

Gettheparametervalueattheselectedpoint:

_$(vlax-curve-getParamAtPoint

ellipseObjselPt)4.58296

Pleasesendusyourcommentaboutthispage

Page 580: less than or equalAutoLISP Functions
Page 581: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getPointAtDist

Returnsthepoint(inWCS)alongacurveatthedistancespecifiedbytheuser

(vlax-curve-getPointAtDistcurve-objdist)

Arguments

curve-obj

TheVLA-objecttobemeasured.

dist

Thedistancealongthecurvefromthebeginningofthecurvetothelocationofthespecifiedpoint.

ReturnValues

A3Dpointlistrepresentingapointonthecurve,ifsuccessful;otherwisenil.

Examples

AssumingthatsplineObjpointstothesplineshownintheexampleforvlax-curve-getDistAtParam,determinethepointatadistanceof1.0fromthebeginningofthespline:

_$(vlax-curve-getPointAtDist

splineObj1.0)(2.242362.990050.0)

Pleasesendusyourcommentaboutthispage

Page 582: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getPointAtParam

Returnsthepointatthespecifiedparametervaluealongacurve

(vlax-curve-getPointAtParamcurve-objparam)

Arguments

curve-obj

TheVLA-objecttobemeasured.

param

Anumberspecifyingaparameteronthecurve.

ReturnValues

A3Dpointlistrepresentingapointonthecurve,ifsuccessful;otherwisenil.

Examples

Forthefollowingexample,assumethatsplineObjpointstothesplineshownintheexampleforvlax-curve-getDistAtParam.

Obtainthestartparameterofthecurve:

_$(setqstartSpline(vlax-curve-getStartParam

splineObj))0.0

Obtaintheendparameterofthecurve:

_$(setqendSpline(vlax-curve-getEndParam

splineObj))17.1546

Page 583: less than or equalAutoLISP Functions

Determinethepointattheparametermidwayalongthecurve:

_$(vlax-curve-getPointAtParam

splineObj

(/(-endsplinestartspline)

2))(6.713862.827480.0)

Pleasesendusyourcommentaboutthispage

Page 584: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getSecondDeriv

Returnsthesecondderivative(inWCS)ofacurveatthespecifiedlocation

(vlax-curve-getSecondDerivcurve-objparam)

Arguments

curve-obj

TheVLA-objecttobemeasured.

param

Anumberspecifyingaparameteronthecurve.

ReturnValues

A3Dvectorlist,ifsuccessful;otherwisenil.

Examples

Forthefollowingexample,assumethatsplineObjpointstothesplineshownintheexampleofthevlax-curve-getDistAtParamfunction.

Obtainthestartparameterofthecurve:

_$(setqstartSpline(vlax-curve-getStartParam

splineObj))0.0

Obtaintheendparameterofthecurve:

_$(setqendSpline(vlax-curve-getEndParam

splineObj))17.1546

Page 585: less than or equalAutoLISP Functions

Determinethesecondderivativeattheparametermidwayalongthecurve:

_$(vlax-curve-getSecondDeriv

splineObj

(/(-endsplinestartspline)

2))(0.01659670.1508480.0)

Pleasesendusyourcommentaboutthispage

Page 586: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getStartParam

Returnsthestartparameteronthecurve

(vlax-curve-getStartParamcurve-obj)

Arguments

curve-obj

TheVLA-objecttobemeasured.

ReturnValues

Arealnumberrepresentingthestartparameter,ifsuccessful;otherwisenil.

Examples

AssumingthatellipseObjpointstotheellipseshownintheexampleforvlax-curve-getArea,determinethestartparameterofthecurve:

_$(vlax-curve-getstartparam

ellipseObj)0.0

SeeAlsoThevlax-curve-getEndParamfunction.

Pleasesendusyourcommentaboutthispage

Page 587: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-getStartPoint

Returnsthestartpoint(inWCS)ofthecurve

(vlax-curve-getStartPointcurve-obj)

Arguments

curve-obj

TheVLA-objecttobemeasured.

ReturnValues

A3Dpointlistrepresentingthestartpoint,ifsuccessful;otherwisenil.

Examples

Getthestartpointoftheellipseusedtodemonstratevlax-curve-getArea:

_$(vlax-curve-getStartPoint

ellipseObj)(2.02.00.0)

Foranellipse,thestartpointsandendpointsarethesame.

Obtainthestartpointofthesplineusedtodemonstratevlax-curve-getDistAtParam:

_$(vlax-curve-getStartPoint

splineObj)(1.739622.125610.0)

Pleasesendusyourcommentaboutthispage

Page 588: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-isClosed

Determinesifthespecifiedcurveisclosed(thatis,thestartpointisthesameastheendpoint)

(vlax-curve-isClosedcurve-obj)

Arguments

curve-obj

TheVLA-objecttobetested.

ReturnValues

Tifthecurveisclosed;otherwisenil.

Examples

Determineiftheellipseusedtodemonstratevlax-curve-getAreaisclosed:

_$(vlax-curve-isClosedellipseObj)T

Determineifthesplineusedtodemonstratevlax-curve-getDistAtParamisclosed:

_$(vlax-curve-isClosedsplineObj)nil

Pleasesendusyourcommentaboutthispage

Page 589: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-isPeriodic

DeterminesifthespecifiedcurvehasaninfiniterangeinbothdirectionsandthereisaperiodvaluedT,suchthatapointonthecurveat(u+dT)=pointoncurve(u),foranyparameteru

(vlax-curve-isPeriodiccurve-obj)

Arguments

curve-obj

TheVLA-objecttobetested.

ReturnValues

Tifthecurveisperiodic;otherwisenil.

Examples

Determineiftheellipseusedtodemonstratevlax-curve-getAreaisperiodic:

_$(vlax-curve-isPeriodic

ellipseObj)T

Determineifthesplineusedtodemonstratevlax-curve-getDistAtParamisperiodic:

_$(vlax-curve-isPeriodic

splineObj)nil

Pleasesendusyourcommentaboutthispage

Page 590: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-curve-isPlanar

Determinesifthereisaplanethatcontainsthecurve

(vlax-curve-isPlanarcurve-obj)

Arguments

curve-obj

TheVLA-objecttobetested.

ReturnValues

Tifthereisaplanethatcontainsthecurve;otherwisenil.

Examples

Determineifthereisaplanecontainingtheellipseusedtodemonstratevlax-curve-getArea:

_$(vlax-curve-isPlanarellipseObj)T

Determineifthereisaplanecontainingthesplineusedtodemonstratevlax-curve-getDistAtParam:

_$(vlax-curve-isPeriodic

splineObj)nil

Pleasesendusyourcommentaboutthispage

Page 591: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-dump-object

Listsanobject'sproperties,andoptionally,themethodsthatapplytotheobject

(vlax-dump-objectobj[T])

Arguments

obj

AVLA-object.

T

Ifspecified,vlax-dump-objectalsolistsallmethodsthatapplytoobj.

ReturnValues

T,ifsuccessful.Ifaninvalidobjectnameissupplied,vlax-dump-objectdisplaysanerrormessage.

Examples

_$(setqaa(vlax-get-acad-object))#<VLA-OBJECTIAcadApplication00b3b91c>

_$(vlax-dump-objectaa);IAcadApplication:AutoCADApplicationInterface

;Propertyvalues:

;ActiveDocument(RO)=#<VLA-OBJECTIAcadDocument01b52fac>

;Application(RO)=#<VLA-OBJECTIAcadApplication00b3b91c>

;Caption(RO)="AutoCAD-[Drawing.dwg]"

.

.

.

T

Listanobject'spropertiesandthemethodsthatapplytotheobject:

Page 592: less than or equalAutoLISP Functions

_$(vlax-dump-objectaaT);IAcadApplication:AutoCADApplicationInterface

;Propertyvalues:

;ActiveDocument(RO)=#<VLA-OBJECTIAcadDocument01b52fac>

;Application(RO)=#<VLA-OBJECTIAcadApplication00b3b91c>

;Caption(RO)="AutoCAD-[Drawing.dwg]"

.

.

.

;Methodssupported:

;EndUndoMark()

;Eval(1)

;GetInterfaceObject(1)

;ListAds()

;ListArx()

.

.

.

T

Pleasesendusyourcommentaboutthispage

Page 593: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ename->vla-object

TransformsanentitytoaVLA-object

(vlax-ename->vla-objectentname)

Arguments

entname

Anentityname(enamedatatype).

ReturnValues

AVLA-object.

Examples

_$(setqe(car(entsel)))<Entityname:27e0540>

_$(vlax-ename->vla-object

e)#<VLA-OBJECTIAcadLWPolyline03f713a0>

SeeAlsoThevlax-vla-object->enamefunction.

Pleasesendusyourcommentaboutthispage

Page 594: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-erased-p

Determineswhetheranobjectwaserased

(vlax-erased-pobj)

Arguments

obj

AVLA-object.

ReturnValues

Tiftheobjectwaserased;otherwisenil.

Pleasesendusyourcommentaboutthispage

Page 595: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-for

Iteratesthroughacollectionofobjects,evaluatingeachexpression

(vlax-forsymbolcollection[expression1[expression2...]])

Arguments

symbol

AsymboltobeassignedtoeachVLA-objectinacollection.

collection

AVLA-objectrepresentingacollectionobject.

expression1,expression2...

Theexpressionstobeevaluated.

ReturnValues

Thevalueofthelastexpressionevaluatedforthelastobjectinthecollection.

Examples

Thefollowingcodeissuesvlax-dump-objectoneverydrawingobjectinthemodelspace:

(vl-load-com);loadActiveXsupport

(vlax-forfor-item

(vla-get-modelspace

(vla-get-activedocument(vlax-get-acad-object))

)

(vlax-dump-objectfor-item);listobjectproperties

)

Page 596: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 597: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-get-acad-object

RetrievesthetoplevelAutoCADapplicationobjectforthecurrentAutoCADsession

(vlax-get-acad-object)

ReturnValues

AVLA-object.

Examples

_$(setqaa(vlax-get-acad-object))#<VLA-OBJECTIAcadApplication00b3b91c>

Pleasesendusyourcommentaboutthispage

Page 598: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-get-object

Returnsarunninginstanceofanapplicationobject

(vlax-get-objectprog-id)

Arguments

prog-id

Astringthatidentifiesthedesiredapplicationobject.Theformatofprog-idis:appname.objecttypewhereappnameisthenameoftheapplicationandobjecttypeistheapplicationobject.Theobjecttypemaybefollowedbyaversionnumber.

Note Youcanusuallyfindtheprog-idforanapplicationinthatapplication'sHelp.Forexample,MicrosoftOfficeapplicationsdocumentthisinformationintheVBAReference.

ReturnValues

Theapplicationobject;otherwisenil,ifthereisnoinstanceofthespecifiedobjectcurrentlyrunning.

Examples

ObtaintheapplicationobjectfortheExcelprogram:

_$(vlax-get-object"Excel.Application")#<VLA-OBJECT_Application0017bb5c>

Pleasesendusyourcommentaboutthispage

Page 599: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-get-or-create-object

Returnsarunninginstanceofanapplicationobject,orcreatesanewinstanceiftheapplicationisnotcurrentlyrunning

(vlax-get-or-create-objectprog-id)

Arguments

prog-id

AstringcontainingtheprogrammaticidentifierofthedesiredActiveXobject.Theformatofprog-idis<Vendor>.<Component>.<Version>Forexample:AutoCAD.Drawing.15

ReturnValues

Theobject.

Examples

_$(vlax-get-or-create-object

"Excel.Application")#<VLA-OBJECT_Application0017bb5c>

Pleasesendusyourcommentaboutthispage

Page 600: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-get-property

RetrievesaVLA-object'sproperty

(vlax-get-propertyobjectproperty)

Thisfunctionwasformerlyknownasvlax-get.

Arguments

object

AVLA-object.

property

Asymbolorstringnamingthepropertytoberetrieved.

ReturnValues

Thevalueoftheobject'sproperty.

Examples

BeginbyretrievingapointertotherootAutoCADobject:

_$(setqacadObject(vlax-get-acad-object))#<VLA-OBJECTIAcadApplication00a4b2b4>

GettheAutoCADActiveDocumentproperty:

_$(setqacadDocument(vlax-get-property

acadObject'ActiveDocument))#<VLA-OBJECTIAcadDocument00302a18>

Thefunctionreturnsthecurrentdocumentobject.

GettheModelSpacepropertyoftheActiveDocumentobject:

Page 601: less than or equalAutoLISP Functions

_$(setqmSpace(vlax-get-property

acadDocument'Modelspace))#<VLA-OBJECTIAcadModelSpace00c14b44>

Themodelspaceobjectofthecurrentdocumentisreturned.

ConvertadrawingentitytoaVLA-object:

_$(setqvlaobj(vlax-ename->vla-object

e))#<VLA-OBJECTIAcadLWPolyline0467114c>

Getthecolorpropertyoftheobject:

_$(vlax-get-propertyvlaobj

'Color)256

SeeAlsoThevlax-property-available-pandvlax-put-propertyfunctions.

Pleasesendusyourcommentaboutthispage

Page 602: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-import-type-library

Importsinformationfromatypelibrary

(vlax-import-type-library:tlb-filenamefilename

[:methods-prefixmprefix:properties-prefixpprefix:constants-prefixc

Arguments

filename

Astringnamingthetypelibrary.Afilecanbeoneofthefollowingtypes:

Atypelibrary(TLB)orobjectlibrary(OLB)file

Anexecutable(EXE)file

Alibrary(DLL)filecontainingatypelibraryresource

Acompounddocumentholdingatypelibrary

AnyotherfileformatthatcanbeunderstoodbytheLoadTypeLibAPI

Ifyouomitthepathfromtlb-filename,AutoCADlooksforthefileinthesupportfilesearchpath.

mprefix

Prefixtobeusedformethodwrapperfunctions.Forexample,ifthetypelibrarycontainsaCalculatemethodandthemprefixparameterissetto“cc-”,VisualLISPgeneratesawrapperfunctionnamedcc-Calculate.Thisparameterdefaultsto“”.

pprefix

Prefixtobeusedforpropertywrapperfunctions.Forexample,ifthetypelibrarycontainsaWidthpropertywithbothreadandwritepermissions,andpprefixissetto“cc-”,thenVisualLISPgenerateswrapperfunctionsnamed

Page 603: less than or equalAutoLISP Functions

cc-get-Widthandcc-put-Width.Thisparameterdefaultsto“”.

cprefix

Prefixtobeusedforconstantscontainedinthetypelibrary.Forexample,ifthetypelibrarycontainsaccMaxCountOfRecordspropertywithbothreadandwritepermissions,andcprefixissetto“cc-”,VisualLISPgeneratesaconstantnamedcc-ccMaxCountOfRecords.Thisparameterdefaultsto“”.

Notetherequireduseofkeywordswhenpassingargumentstovlax-import-type-library.

ReturnValues

T,ifsuccessful.

Examples

ImportaMicrosoftWordtypelibrary,assigningtheprefix“msw-”tomethodsandproperties,and“mswc-”toconstants:

_$(vlax-import-type-library

:tlb-filename"c:/program

files/microsoftoffice/msword8.olb"

:methods-prefix"msw-"

:properties-prefix

"msw-"

:constants-prefix"mswc-")T

Remarks

Functionwrapperscreatedbyvlax-import-type-libraryareavailableonlyinthecontextofthedocumentvlax-import-type-librarywasissuedfrom.

InthecurrentreleaseofVisualLISP,vlax-import-type-libraryisexecutedatruntime,ratherthanatcompiletime.InfuturereleasesofVisualLISP,thismaychange.Thefollowingpracticesarerecommendedwhenusingvlax-import-type-library:

Ifyouwantyourcodetorunondifferentmachines,avoidspecifyingan

Page 604: less than or equalAutoLISP Functions

absolutepathinthetlb-file-nameparameter.

Ifpossible,avoidusingvlax-import-type-libraryfrominsideanyAutoLISPexpression(thatis,alwayscallitfromatop-levelposition).

InyourAutoLISPsourcefile,codethevlax-import-type-librarycallbeforeanycodethatusesmethodorpropertywrappersorconstantsdefinedinthetypelibrary.

SeeAlsoThevlax-typeinfo-available-pfunction.

Pleasesendusyourcommentaboutthispage

Page 605: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-invoke-method

CallsthespecifiedActiveXmethod

(vlax-invoke-methodobjmethodarg[arg...])

Thisfunctionwasknownasvlax-invokepriortoAutoCAD2000.

Arguments

obj

AVLA-object.

method

Asymbolorstringnamingthemethodtobecalled.

arg

Argumenttobepassedtothemethodcalled.Noargumenttypecheckingisperformed.

ReturnValues

Dependsonthemethodinvoked.

Examples

ThefollowingexampleusestheAddCirclemethodtodrawacircleinthecurrentAutoCADdrawing.

ThefirstargumenttoAddCirclespecifiesthelocationofthecenterofthecircle.Themethodrequiresthecentertobespecifiedasavariantcontainingathree-elementarrayofdoubles.Youcanusevlax-3d-pointtoconvertanAutoLISPpointlisttotherequiredvariantdatatype:

_$(setqcircCenter(vlax-3d-point

Page 606: less than or equalAutoLISP Functions

'(3.03.00.0)))#<variant8197...>

Nowusevlax-invoke-methodtodrawacirclewiththeAddCirclemethod:

_$(setqmycircle(vlax-invoke-method

mspace'AddCirclecircCenter3.0))#<VLA-OBJECTIAcadCircle00bfd6e4>

SeeAlsoThevlax-get-property,vlax-method-applicable-p,vlax-property-available-p,andvlax-put-propertyfunctions.

Pleasesendusyourcommentaboutthispage

Page 607: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ldata-delete

ErasesLISPdatafromadrawingdictionary

(vlax-ldata-deletedictkey[private])

Arguments

dict

AVLA-object,AutoCADdrawingentityobject,orastringnamingaglobaldictionary.

key

Astringspecifyingthedictionarykey.

private

Ifanon-nilvalueisspecifiedforprivateandvlax-ldata-deleteiscalledfromaseparate-namespaceVLX,vlax-ldata-deletedeletesprivateLISPdatafromdict.(Seevlax-ldata-getforexamplesusingthisargument.)

ReturnValues

T,ifsuccessful;otherwisenil(forexample,thedatadidnotexist).

Examples

AddLISPdatatoadictionary:

_$(vlax-ldata-put"dict"

"key"'(1))(1)

Usevlax-ldata-deletetodeletetheLISPdata:

Page 608: less than or equalAutoLISP Functions

_$(vlax-ldata-delete"dict"

"key")T

Ifvlax-ldata-deleteiscalledagaintoremovethesamedata,itreturnsnilbecausethedatadoesnotexistinthedictionary:

_$(vlax-ldata-delete"dict"

"key")nil

SeeAlsoThevlax-ldata-get,vlax-ldata-list,andvlax-ldata-putfunctions.

Pleasesendusyourcommentaboutthispage

Page 609: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ldata-get

RetrievesLISPdatafromadrawingdictionaryoranobject

(vlax-ldata-getdictkey[default-data][private])

Arguments

dict

AVLA-object,anAutoCADdrawingentityobject,orastringnamingaglobaldictionary.

key

Astringspecifyingthedictionarykey.

default-data

LISPdatatobereturnedifnomatchingkeyexistsinthedictionary.

private

Ifanon-nilvalueisspecifiedforprivateandvlax-ldata-getiscalledfromaseparate-namespaceVLX,vlax-ldata-getretrievesprivateLISPdatafromdict.Ifyouspecifyprivate,youmustalsospecifydefault-data;youcanusenilfordefault-data.

Notethataseparate-namespaceVLXcanstorebothprivateandnon-privatedatausingthesamedictandkey.TheprivatedatacanbeaccessedonlybythesameVLX,butanyapplicationcanretrievethenon-privatedata.

ReturnValues

Thevalueofthekeyitem.

Examples

Page 610: less than or equalAutoLISP Functions

EnterthefollowingcommandsattheVisualLISPConsolewindow:

_$(vlax-ldata-put"mydict"

"mykey""MumboDumbo")"MumboDumbo"

_$(vlax-ldata-get"mydict"

"mykey")"MumboDumbo"

TotesttheuseofprivatedatafromaVLX

1. EnterthefollowingcommandsattheVisualLISPConsolewindow:

_$(vlax-ldata-put"mydict"

"mykey""MumboDumbo")"MumboDumbo"

_$(vlax-ldata-get"mydict"

"mykey")"MumboDumbo"

2. EnterthefollowingcodeinafileanduseMakeApplicationtobuildaVLXfromthefile.UsetheExpertmodeoftheMakeApplicationwizard,andselecttheSeparateNamespaceoptionontheCompileOptionstab.

(vl-doc-export'ldataput)

(vl-doc-export'ldataget)

(vl-doc-export'ldataget-nilt)

(defunldataput()

(princ"Thisisatestofputtingprivateldata")

(vlax-ldata-put"mydict""mykey""Mine!Mine!"T)

)

(defunldataget()

(vlax-ldata-get"mydict""mykey")

)

(defunldataget-nilt()

(vlax-ldata-get"mydict""mykey"nilT)

)

3. LoadtheVLXfile.

4. Runldataputtosaveprivatedata:

Page 611: less than or equalAutoLISP Functions

_$(ldataput)Thisisatestofputtingprivateldata

Refertothecodedefiningldataput:thisfunctionstoresastringcontaining“Mine!Mine!”

5. RunldatagettoretrieveLISPdata:

_$(ldataget)"MumboDumbo"

Noticethatthedatareturnedbyldatagetisnotthedatastoredbyldataput.Thisisbecauseldatagetdoesnotspecifytheprivateargumentinitscalltovlax-ldata-get.Sothedataretrievedbyldatagetisthedatasetbyissuingvlax-ldata-putfromtheVisualLISPConsoleinstep1.

_$(ldataget-nilt)"Mine!Mine!"

6. Runldataget-nilttoretrieveLISPdata:

_$(ldataget-nilt)"Mine!Mine!"

Thistimetheprivatedatasavedbyldataputisreturned,becauseldataget-niltspecifiestheprivateargumentinitscalltovlax-ldata-get.

7. FromtheVisualLISPConsoleprompt,issuethesamecallthatldataget-niltusestoretrieveprivatedata:

_$(vlax-ldata-get"mydict"

"mykey"nilT)"MumboDumbo"

Theprivateargumentisignoredwhenvlax-ldata-getisissuedoutsideaseparate-namespaceVLX.Ifnon-privatedataexistsforthespecifieddictandkey(asinthisinstance),thatdatawillberetrieved.

Pleasesendusyourcommentaboutthispage

Page 612: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ldata-list

ListsLISPdatainadrawingdictionary

(vlax-ldata-listdict[private])

Arguments

dict

AVLA-object,anAutoCADdrawingentityobject,orastringnamingaglobaldictionary.

private

Ifvlax-ldata-listiscalledfromaseparate-namespaceVLXandanon-nilvalueisspecifiedforprivate,vlax-ldata-listretrievesonlyprivatedatastoredbythesameVLX.(Seevlax-ldata-getforexamplesusingthisargument.)

ReturnValues

Anassociativelistconsistingofpairs(key.value).

Examples

Usevlax-ldata-puttostoreLISPdatainadictionary:

_$(vlax-ldata-put"dict"

"cay""MumboJumbo")"MumboJumbo"

_$(vlax-ldata-put"dict"

"say""Floobar")"Floobar"

Usevlax-ldata-listtodisplaytheLISPdatastoredin“dict”:

Page 613: less than or equalAutoLISP Functions

_$(vlax-ldata-list"dict")(("say"."Floobar")("cay"."MumboJumbo"))

SeeAlsoThevlax-ldata-get,vlax-ldata-delete,andvlax-ldata-putfunctions.

Pleasesendusyourcommentaboutthispage

Page 614: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ldata-put

StoresLISPdatainadrawingdictionaryoranobject

(vlax-ldata-putdictkeydata[private])

Arguments

dict

AVLA-object,anAutoCADdrawingentityobject,orastringnamingaglobaldictionary.

key

Astringspecifyingthedictionarykey.

data

LISPdatatobestoredinthedictionary.

private

Ifvlax-ldata-putiscalledfromaseparate-namespaceVLXandanon-nilvalueisspecifiedforprivate,vlax-ldata-putmarksthedataasretrievableonlybythesameVLX.

ReturnValues

Thevalueofdata.

Examples

_$(vlax-ldata-put"dict"

"key"'(1))(1)

_$(vlax-ldata-put"dict"

"cay""Gumbojumbo")

Page 615: less than or equalAutoLISP Functions

"Gumbojumbo"

SeeAlsoThevlax-ldata-get,vlax-ldata-delete,andvlax-ldata-listfunctions.

Pleasesendusyourcommentaboutthispage

Page 616: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-ldata-test

Determinesifdatacanbesavedoverasessionboundary

(vlax-ldata-testdata)

Arguments

data

AnyLISPdatatobetested.

ReturnValues

T,ifthedatacanbesavedandrestoredoverthesessionboundary;otherwisenil.

Examples

Determineifastringcanbesavedasldataoverasessionboundary:

_$(vlax-ldata-test"Gumbo

jumbo")T

Determineifafunctioncanbesavedasldataoverasessionboundary:

_$(vlax-ldata-testyinyang)nil

SeeAlsoThevlax-ldata-get,vlax-ldata-delete,andvlax-ldata-list,andvlax-ldata-putfunctions.

Page 617: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 618: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-make-safearray

Createsasafearray

(vlax-make-safearraytype'(l-bound.u-bound)

['(l-bound.u-bound)...)]

Amaximumof16dimensionscanbedefinedforanarray.Theelementsinthearrayareinitializedasfollows:

Numbers

0

Strings

Zero-lengthstring.

Booleans

:vlax-false

Object

nil

Variant

Uninitialized(vlax-vbEmpty)

Arguments

type

Thetypeofsafearray.Specifyoneofthefollowingconstants:vlax-vbInteger(2) Integervlax-vbLong(3) Longintegervlax-vbSingle(4) Single-precisionfloating-pointnumber

Page 619: less than or equalAutoLISP Functions

vlax-vbDouble(5) Double-precisionfloating-pointnumbervlax-vbString(8) Stringvlax-vbObject(9) Objectvlax-vbBoolean(11) Booleanvlax-vbVariant(12) VariantTheintegershowninparenthesesindicatesthevaluetowhichtheconstantevaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,nottheintegervalue,incasethevaluechangesinlaterreleasesofAutoCAD.

'(l-bound.u-bound)

Lowerandupperindexboundariesofadimension.

ReturnValues

Thesafearraycreated.

Examples

Createasingle-dimensionsafearrayconsistingofdoubles,beginningwithindex0:

_$(setqpoint(vlax-make-safearray

vlax-vbDouble'(0.3)))#<safearray...>

Usethevlax-safearray->listfunctiontodisplaythecontentsofthesafearrayasalist:

_$(vlax-safearray->list

point)(0.00.00.00.0)

Theresultshowseachelementofthearraywasinitializedtozero.

Createatwo-dimensionarrayofstrings,witheachdimensionstartingatindex1:

_$(setqmatrix(vlax-make-safearray

vlax-vbString'(1.2)'(1.2)))#<safearray...>

Page 620: less than or equalAutoLISP Functions

SeeAlsoThevlax-make-variant,vlax-safearray-fill,vlax-safearray-get-dim,vlax-safearray-get-element,vlax-safearray-get-l-bound,vlax-safearray-get-u-bound,vlax-safearray-put-element,vlax-safearray-type,vlax-safearray->list,andvlax-variant-valuefunctions.Formoreinformationonusingthesefunctions,seeWorkingwithSafearraysintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 621: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-make-variant

Createsavariantdatatype

(vlax-make-variant[value][type])

Arguments

value

Thevaluetobeassignedtothevariant.Ifomitted,thevariantiscreatedwiththevlax-vbEmptytype(uninitialized).

type

Thetypeofvariant.Thiscanberepresentedbyoneofthefollowingconstants:vlax-vbEmpty(0) Uninitialized(defaultvalue)vlax-vbNull(1) Containsnovaliddatavlax-vbInteger(2) Integervlax-vbLong(3) Longintegervlax-vbSingle(4) Single-precisionfloating-pointnumbervlax-vbDouble(5) Double-precisionfloating-pointnumbervlax-vbString(8) Stringvlax-vbObject(9) Objectvlax-vbBoolean(11) Booleanvlax-vbArray(8192) ArrayTheintegershowninparenthesesindicatesthevaluetowhichtheconstantevaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,nottheintegervalue,becausethevaluemaychangeinlaterreleasesofAutoCAD.Ifyoudonotspecifyatype,vlax-make-variantassignsadefaultdata

Page 622: less than or equalAutoLISP Functions

typebasedonthedatatypeofthevalueitreceives.ThefollowinglistidentifiesthedefaultvariantdatatypeassignedtoeachLISPdatatype:nil vlax-vbEmpty

:vlax-null vlax-vbNull

integer vlax-vbLong

real vlax-vbDouble

string vlax-vbString

VLA-object vlax-vbObject

:vlax-true,:vlax-false vlax-vbBoolean

variant Sameasthetypeofinitialvaluevlax-make-safearray vlax-vbArray

ReturnValues

Thevariantcreated.

Examples

Createavariantusingthedefaultsforvlax-make-variant:

_$(setqvarnil(vlax-make-variant))#<variant0>

Thefunctioncreatesanuninitialized(vlax-vbEmpty)variantbydefault.Youcanaccomplishthesamethingexplicitlywiththefollowingcall:

_$(setqvarnil(vlax-make-variant

nil))#<variant0>

Createanintegervariantandsetitsvalueto5:

_$(setqvarint(vlax-make-variant

5vlax-vbInteger))#<variant25>

Repeatthepreviouscommand,butomitthetypeargumentandseewhathappens:

Page 623: less than or equalAutoLISP Functions

_$(setqvarint(vlax-make-variant

5))#<variant35>

Bydefault,vlax-make-variantassignedthespecifiedintegervaluetoaLongintegerdatatype,notInteger,asyoumightexpect.Thishighlightstheimportanceofexplicitlystatingthetypeofvariantyouwantwhenworkingwithnumbers.

Omittingthetypeargumentforastringproducespredictableresults:

_$(setqvarstr(vlax-make-variant

"ghost"))#<variant8ghost>

Tocreateavariantcontainingarrays,youmustspecifytypevlax-vbArray,alongwiththetypeofdatainthearray.Forexample,tocreateavariantcontaininganarrayofdoubles,firstsetavariable'svaluetoanarrayofdoubles:

_$(setq4dubs(vlax-make-safearray

vlax-vbDouble'(0.3)))#<safearray...>

Thentakethearrayofdoublesandassignittoavariant:

_$(vlax-make-variant4dubs)#<variant8197...>

SeeAlsoThevlax-make-safearray,vlax-variant-change-type,vlax-variant-type,andvlax-variant-valuefunctions.Formoreinformationonusingvariants,seeWorkingwithVariantsintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 624: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-map-collection

Appliesafunctiontoallobjectsinacollection

(vlax-map-collectionobjfunction)

Arguments

obj

AVLA-objectrepresentingacollection.

function

Asymbolorlambdaexpressiontobeappliedtoobj.

ReturnValues

Theobjfirstargument.

Examples

(vlax-map-collection(vla-get-ModelSpace

acadDocument)'vlax-dump-object);IAcadLWPolyline:AutoCADLightweightPolylineInterface

;Propertyvalues:

;Application(RO)=#<VLA-OBJECTIAcadApplication00a4ae24>

;Area(RO)=2.46556

;Closed=0

;Color=256

;ConstantWidth=0.0

;Coordinate=...Indexedcontentsnotshown...

;Coordinates=(8.499177.0015511.29963.7313714.85.74379...)

;Database(RO)=#<VLA-OBJECTIAcadDatabase01e3da44>

;Elevation=0.0

;Handle(RO)="53"

;HasExtensionDictionary(RO)=0

;Hyperlinks(RO)=#<VLA-OBJECTIAcadHyperlinks01e3d7d4>

;Layer="0"

Page 625: less than or equalAutoLISP Functions

;Linetype="BYLAYER"

;LinetypeGeneration=0

;LinetypeScale=1.0

;Lineweight=-1

;Normal=(0.00.01.0)

;ObjectID(RO)=28895576

;ObjectName(RO)="AcDbPolyline"

;PlotStyleName="ByLayer"

;Thickness=0.0

;Visible=-1

T

Pleasesendusyourcommentaboutthispage

Page 626: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-method-applicable-p

Determinesifanobjectsupportsaparticularmethod

(vlax-method-applicable-pobjmethod)

Arguments

obj

AVLA-object.

method

Asymbolorstringcontainingthenameofthemethodtobechecked.

ReturnValues

T,iftheobjectsupportsthemethod;otherwisenil.

Examples

ThefollowingcommandsareissuedagainstaLightweightPolylineobject:

_$(vlax-method-applicable-p

WhatsMyLine'copy)T

_$(vlax-method-applicable-p

WhatsMyLine'AddBox)nil

SeeAlsoThevlax-property-available-pfunction.

Pleasesendusyourcommentaboutthispage

Page 627: less than or equalAutoLISP Functions
Page 628: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-object-released-p

Determinesifanobjecthasbeenreleased

(vlax-object-released-pobj)

Note ErasingaVLA-object(usingcommandERASEorvla-erase)doesnotreleasetheobject.AVLA-objectisnotreleaseduntilyouinvokevlax-release-objectontheobject,ornormalAutoLISPgarbagecollectionoccurs,orthedrawingdatabaseisdestroyedattheendofthedrawingsession.

Arguments

obj

AVLA-object.

ReturnValues

T,iftheobjectisreleased(noAutoCADdrawingobjectisattachedtoobj);niliftheobjecthasnotbeenreleased.

Examples

AttachaMicrosoftExcelapplicationtothecurrentAutoCADdrawing:

_$(setqexcelobj(vlax-get-object

"Excel.Application"))#<VLA-OBJECT_Application00168a54>

ReleasetheExcelobject:

_$(vlax-release-objectexcelobj)1

Issuevlax-object-released-ptoverifytheobjectwasreleased:

Page 629: less than or equalAutoLISP Functions

_$(vlax-object-released-p

excelobj)T

Pleasesendusyourcommentaboutthispage

Page 630: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-product-key

ReturnstheAutoCADWindowsregistrypath

(vlax-product-key)

TheAutoCADregistrypathcanbeusedtoregisteranapplicationfordemandloading.

ReturnValues

AstringcontainingtheAutoCADregistrypath.

Examples

_$(vlax-product-key)"Software\\Autodesk\\AutoCAD\\R15.0\\ACAD-1:409"

Pleasesendusyourcommentaboutthispage

Page 631: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-property-available-p

Determinesifanobjecthasaspecifiedproperty

(vlax-property-available-pobjprop[check-modify])

Arguments

obj

AVLA-object.

property

Asymbolorstringnamingthepropertytobechecked.

check-modify

IfTisspecifiedforthisargument,vlax-property-available-palsochecksthatthepropertycanbemodified.

ReturnValues

T,iftheobjecthasthespecifiedproperty;otherwisenil.IfTisspecifiedforthecheck-modifyargument,vlax-property-available-preturnsnilifeitherthepropertyisnotavailableorthepropertycannotbemodified.

Examples

ThefollowingexamplesapplytoaLightweightPolylineobject:

_$(vlax-property-available-p

WhatsMyLine'Color)T

_$(vlax-property-available-p

WhatsMyLine'center)nil

Page 632: less than or equalAutoLISP Functions

ThefollowingexamplesapplytoaCircleobject:

_$(vlax-property-available-p

myCircle'area)T

Notehowsupplyingtheoptionalthirdargumentchangestheresult:

_$(vlax-property-available-p

myCircle'areaT)nil

Thefunctionreturnsnilbecause,althoughthecirclehasan“area”property,thatpropertycannotbemodified.

SeeAlsoThevlax-method-applicable-pandvlax-put-propertyfunctions.

Pleasesendusyourcommentaboutthispage

Page 633: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-put-property

SetsthepropertyofanActiveXobject

(vlax-put-propertyobjpropertyarg)

Thisfunctionwasformerlyknownasvlax-put.

Arguments

obj

AVLA-object.

property

Asymbolorstringnamingthepropertytobeset.

arg

Thevaluetobeset.

ReturnValues

Nil,ifsuccessful.

Examples

Coloranobjectred:

_$(vlax-put-propertyvlaobj

'Color1)nil

SeeAlsoThevlax-get-propertyandvlax-property-available-pfunctions.

Page 634: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 635: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-read-enabled-p

Determinesifanobjectcanberead

(vlax-read-enabled-pobj)

Arguments

obj

AVLA-object.

ReturnValues

T,iftheobjectisreadable;otherwisenil.

Pleasesendusyourcommentaboutthispage

Page 636: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-release-object

Releasesadrawingobject

(vlax-release-objectobj)

WhenanAutoLISProutinenolongerusesanobjectoutsideAutoCAD,suchasaMicrosoftExcelobject,callthe(vlax-release-object)functiontomakesurethattheassociatedapplicationclosesproperly.Objectsreleasedwith(vlax-release-object...)maynotbereleasedimmediately.Theactualreleasemaynothappenuntilthenextautomaticgarbagecollectionoccurs.Youcancall(gc)directlytoforcethegarbagecollectiontooccurataspecificlocationwithinyourcode.However,calling(gc)maydegradeperformance,anditisrecommendedthatyouavoidplacingcallsto(gc)inlocationswhereitislikelytobecalledmanytimesinarow,suchaswithinloops.

Ifanobject-associatedapplicationdoesnotcloseaftercallingthe(gc)function,the(vlax-release-object)functionwasnotcalledforallobjectsoutsideAutoCAD.

Arguments

obj

AVLA-object.

Afterrelease,thedrawingobjectisnolongeraccessiblethroughobj.

ReturnValues

Unspecified.

Pleasesendusyourcommentaboutthispage

Page 637: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-remove-cmd

Removesasinglecommandoracommandgroup

(vlax-remove-cmdglobal-name)

RemovesasinglecommandorthewholecommandgroupforthecurrentAutoCADsession.

Arguments

global-name

Eitherastringnamingthecommand,orT.Ifglobal-nameisT,thewholecommandgroupVLC-AppName(forexample,VLC-VLIDE)isdeleted.

ReturnValues

T,ifsuccessful;otherwisenil(forexample,thecommandisnotdefined).

Examples

Removeacommanddefinedwithvlax-add-cmd:

_$(vlax-remove-cmd"hello-autocad")T

Repeatthevlax-remove-cmd:

_$(vlax-remove-cmd"hello-autocad")nil

Thistimevlax-remove-cmdreturnsnil,becausethespecifiedcommanddoesnotexistanymore.

SeeAlso

Page 638: less than or equalAutoLISP Functions

Thevlax-add-cmdfunction.

Pleasesendusyourcommentaboutthispage

Page 639: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-fill

Storesdataintheelementsofasafearray

(vlax-safearray-fillvar'element-values)

Arguments

var

Avariablewhosedatatypeisasafearray.

'element-values

Alistofvaluestobestoredinthearray.Youcanspecifyasmanyvaluesasthereareelementsinthearray.Ifyouspecifyfewervaluesthanthereareelements,theremainingelementsretaintheircurrentvalue.Formulti-dimensionarrays,element-valuesmustbealistoflists,witheachlistcorrespondingtoadimensionofthearray.

ReturnValues

var

Examples

Createasingle-dimensionarrayofdoubles:

_$(setqsa(vlax-make-safearray

vlax-vbdouble'(0.2)))#<safearray...>

Usevlax-safearray-filltopopulatethearray:

_$(vlax-safearray-fillsa

'(123))

Page 640: less than or equalAutoLISP Functions

#<safearray...>

Listthecontentsofthearray:

_$(vlax-safearray->list

sa)(1.02.03.0)

Usevlax-safearray-filltosetthefirstelementinthearray:

_$(vlax-safearray-fillsa

'(-66))#<safearray...>

Listthecontentsofthearray:

_$(vlax-safearray->list

sa)(-66.02.03.0)

Noticethatonlythefirstelementinthearrayhasbeenchanged;theremainingelementsareunaffectedandretainthevalueyoupreviouslysetthemto.Ifyouneedtochangethesecondorthirdelementandleavethefirstelementunaffected,usevlax-put-element.

Instructvlax-safearray-filltosetfourelementsinanarraythatcontainsonlythreeelements:

_$(vlax-safearray-fillsa

'(1234))Error:Assertionfailed:safearray-fillfailed.Toomanyelements.

Thevlax-safearray-fillfunctionreturnsanerrorifyouspecifymoreelementsthanthearraycontains.

Toassignvaluestoamulti-dimensionalarray,specifyalistofliststovlax-safearray-fill,witheachlistcorrespondingtoadimension.Thefollowingcommandcreatesatwo-dimensionarrayofstringscontainingthreeelementsineachdimension:

_$(setqmat2(vlax-make-safearray

vlax-vbString'(0.1)'(1.3)))

Page 641: less than or equalAutoLISP Functions

#<safearray...>

Usevlax-safearray-filltopopulatethearray:

_$(vlax-safearray-fillmat2

'(("a""b""c")("d""e""f")))#<safearray...>

Callthevlax-safearray->listfunctiontoconfirmthecontentsofmat2:

_$(vlax-safearray->list

mat2)(("a""b""c")("d""e""f"))

SeeAlsoThevlax-make-safearray,vlax-safearray-get-dim,vlax-safearray-get-element,vlax-safearray-get-l-bound,vlax-safearray-get-u-bound,vlax-safearray-put-element,vlax-safearray-type,vlax-safearray->list,andvlax-variant-valuefunctions.

Pleasesendusyourcommentaboutthispage

Page 642: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-get-dim

Returnsthenumberofdimensionsinasafearrayobject

(vlax-safearray-get-dimvar)

Arguments

var

Avariablewhosedatatypeisasafearray.

ReturnValues

Anintegeridentifyingthenumberofdimensionsinvar.Anerroroccursifvarisnotasafearray.

Examples

Setsa-inttoasingle-dimensionsafearraywithonedimension:

_$(setqsa-int(vlax-make-safearray

vlax-vbinteger'(1.4)))#<safearray...>

Usevlax-safearray-get-dimtoreturnthenumberofdimensionsinsa-int:

_$(vlax-safearray-get-dim

sa-int)1

SeeAlsoThevlax-make-safearray,vlax-safearray-get-l-bound,andvlax-safearray-get-u-boundfunctions.

Page 643: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 644: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-get-element

Returnsanelementfromanarray

(vlax-safearray-get-elementvarelement...)

Arguments

var

Avariablewhosedatatypeisasafearray.

element...

Integersspecifyingtheindexesoftheelementtoberetrieved.Foranarraywithonedimension,specifyasingleinteger.Formulti-dimensionarrays,specifyasmanyindexesastherearedimensions.

ReturnValues

Thevalueoftheelement.

Examples

Createanarraywithtwodimensions,eachdimensionstartingatindex1:

_$(setqmatrix(vlax-make-safearray

vlax-vbString'(1.2)'(1.2)))#<safearray...>

Usevlax-safearray-put-elementtopopulatethearray:

_$(vlax-safearray-put-element

matrix11"a")"a"

_$(vlax-safearray-put-element

matrix12"b")

Page 645: less than or equalAutoLISP Functions

"b"

_$(vlax-safearray-put-element

matrix21"c")"c"

_$(vlax-safearray-put-element

matrix22"d")"d"

Usevlax-safearray-get-elementtoretrievethesecondelementinthefirstdimensionofthearray:

_$(vlax-safearray-get-element

matrix12)"b"

SeeAlsoThevlax-make-safearray,vlax-safearray-get-dim,vlax-safearray-get-l-bound,vlax-safearray-get-u-bound,andvlax-safearray-put-elementfunctions.

Pleasesendusyourcommentaboutthispage

Page 646: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-get-l-bound

Returnsthelowerboundary(startingindex)ofadimensionofanarray

(vlax-safearray-get-l-boundvardim)

Arguments

var

Avariablewhosedatatypeisasafearray.

dim

Adimensionofthearray.Thefirstdimensionisdimension1.

ReturnValues

Anintegerrepresentingthelowerboundary(startingindex)ofthedimension.Ifvarisnotanarray,ordimisinvalid(forexample,0,oranumbergreaterthanthenumberofdimensionsinthearray),anerrorresults.

Examples

Thefollowingexamplesevaluateasafearraydefinedasfollows:

(vlax-make-safearrayvlax-vbString'(1.2)'(0.1)))

Getthestartingindexvalueofthearray'sfirstdimension:

_$(vlax-safearray-get-l-bound

tmatrix1)1

Thefirstdimensionstartswithindex1.

Getthestartingindexvalueoftheseconddimensionofthearray:

Page 647: less than or equalAutoLISP Functions

_$(vlax-safearray-get-l-bound

tmatrix2)0

Theseconddimensionstartswithindex0.

SeeAlsoThevlax-make-safearray,vlax-safearray-get-dim,andvlax-safearray-get-u-boundfunctions.

Pleasesendusyourcommentaboutthispage

Page 648: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-get-u-bound

Returnstheupperboundary(endindex)ofadimensionofanarray

(vlax-safearray-get-u-boundvardim)

Arguments

var

Avariablewhosedatatypeisasafearray.

dim

Adimensionofthearray.Thefirstdimensionisdimension1.

ReturnValues

Anintegerrepresentingtheupperboundary(endindex)ofthedimension.Ifvarisnotanarray,ordimisinvalid(forexample,0,oranumbergreaterthanthenumberofdimensionsinthearray),anerrorresults.

Examples

Thefollowingexamplesevaluateasafearraydefinedasfollows:

(vlax-make-safearrayvlax-vbString'(1.2)'(0.1)))

Gettheendindexvalueofthearray'sfirstdimension:

_$(vlax-safearray-get-u-bound

tmatrix1)2

Thefirstdimensionendswithindex2.

Gettheendindexvalueoftheseconddimensionofthearray:

Page 649: less than or equalAutoLISP Functions

_$(vlax-safearray-get-u-bound

tmatrix2)1

Theseconddimensionstartswithindex1.

SeeAlsoThevlax-make-safearray,vlax-safearray-get-dim,andvlax-safearray-get-l-boundfunctions.

Pleasesendusyourcommentaboutthispage

Page 650: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-put-element

Addsanelementtoanarray

(vlax-safearray-put-elementvarindex...value)

Arguments

var

Avariablewhosedatatypeisasafearray.

index...

Asetofindexvaluespointingtotheelementyouareassigningavalueto.Forasingle-dimensionarray,specifyoneindexvalue;foratwo-dimensionarray,specifytwoindexvalues,andsoon.

value

Thevaluetoassignthesafearrayelement.

ReturnValues

Thevalueassignedtotheelement.

Examples

Createasingle-dimensionarrayconsistingofdoubles:

_$(setqpoint(vlax-make-safearray

vlax-vbDouble'(0.2)))#<safearray...>

Usevlax-safearray-put-elementtopopulatethearray:

_$(vlax-safearray-put-element

Page 651: less than or equalAutoLISP Functions

point0100)100

_$(vlax-safearray-put-element

point1100)100

_$(vlax-safearray-put-element

point20)0

Createatwo-dimensionarrayconsistingofstrings:

_$(setqmatrix(vlax-make-safearray

vlax-vbString'(1.2)'(1.2)))#<safearray...>

Usevlax-safearray-put-elementtopopulatethearray:

_$(vlax-safearray-put-element

matrix11"a")"a"

_$(vlax-safearray-put-element

matrix12"b")"b"

_$(vlax-safearray-put-element

matrix21"c")"c"

_$(vlax-safearray-put-element

matrix22"d")"d"

Notethatyoucanalsopopulatearraysusingthevlax-safearray-fillfunction.Thefollowingfunctioncallaccomplishesthesametaskasthreevlax-safearray-put-elementcalls:

(vlax-safearray-fillmatrix'(("a""b")("c""d")))

SeeAlsoThevlax-safearray-get-element,vlax-safearray-fill,andvlax-safearray-typefunctions.

Page 652: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 653: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray-type

Returnsthedatatypeofasafearray

(vlax-safearray-typevar)

Arguments

var

Avariablecontainingasafearray.

ReturnValues

Ifvarcontainsasafearray,oneofthefollowingintegersisreturned:

2Integer(vlax-vbInteger)

3Longinteger(vlax-vbLong)

4Single-precisionfloating-pointnumber(vlax-vbSingle)

5Double-precisionfloating-pointnumber(vlax-vbDouble)

8String(vlax-vbString)

9Object(vlax-vbObject)

11Boolean(vlax-vbBoolean)

12Variant(vlax-vbVariant)

Ifvardoesnotcontainasafearray,anerrorresults.

Examples

Createasingle-dimensionarrayofdoublesandatwo-dimensionarrayofstrings:

Page 654: less than or equalAutoLISP Functions

_$(setqpoint(vlax-make-safearray

vlax-vbDouble'(0.2)))#<safearray...>

_$(setqmatrix(vlax-make-safearray

vlax-vbString'(1.2)'(1.2)))#<safearray...>

Usevlax-safearray-typetoverifythedatatypeofthesafearrays:

_$(vlax-safearray-typepoint)5

_$(vlax-safearray-typematrix)8

SeeAlsoThevlax-make-safearrayfunction.

Pleasesendusyourcommentaboutthispage

Page 655: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-safearray->list

Returnstheelementsofasafearrayinlistform

(vlax-safearray->listvar)

Arguments

var

Avariablecontainingasafearray.

ReturnValues

Alist.

Examples

Createasingle-dimensionarrayofdoubles:

_$(setqpoint(vlax-make-safearray

vlax-vbDouble'(0.2)))#<safearray...>

Usevlax-safearray-put-elementtopopulatethearray:

_$(vlax-safearray-put-element

point0100)100

_$(vlax-safearray-put-element

point1100)100

_$(vlax-safearray-put-element

point20)0

Page 656: less than or equalAutoLISP Functions

Convertthearraytoalist:

_$(setqpointlist(vlax-safearray->list

point))(100.0100.00.0)

Thefollowingexampledemonstrateshowatwo-dimensionarrayofstringsisdisplayedbyvlax-safearray->list:

_$(vlax-safearray->list

matrix)(("a""b")("c""d"))

SeeAlsoThevlax-make-safearray,vlax-safearray-fill,andvlax-safearray-put-elementfunctions.

Pleasesendusyourcommentaboutthispage

Page 657: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-tmatrix

Returnsasuitablerepresentationfora4x4transformationmatrixtobeusedinVLAmethods

(vlax-tmatrixlist)

Arguments

list

Alistoffourlists,eachcontainingfournumbers,representingtransformationmatrixelements.

ReturnValues

Avariantoftypesafearray,representingthe4×4transformationmatrix.

Examples

Defineatransformationmatrixandassignitsvaluetovariabletmatrix:

_$(setqtmatrix(vlax-tmatrix

'((1110)(1230)(2345)(2983))))#<variant8197...>

Usevlax-safearray->listtoviewthevalueoftmatrixinlistform:

_$(vlax-safearray->list

(vlax-variant-valuetmatrix))((1.01.01.00.0)(1.02.03.00.0)(2.03.04.05.0)(2.09.08.03.0))

Thefollowingcodeexamplecreatesalineandrotatesit90degreesusingatransformationmatrix:

(defunExample_TransformBy();/lineObjstartPtendPtmatListtransMat)

Page 658: less than or equalAutoLISP Functions

(vl-load-com);LoadActiveXsupport

(setqacadObject(vlax-get-acad-object))

(setqacadDocument(vla-get-ActiveDocumentacadObject))

(setqmSpace(vla-get-ModelSpaceacadDocument))

;;Createaline

(setqstartPt(getpoint"Pickthestartpoint"))

(setqendPt(vlax-3d-point(getpointstartPt"Picktheendpoint")))

(setqlineObj(vla-addlinemSpace(vlax-3d-pointstartPt)endPt))

;;;InitializethetransMatvariablewithatransformationmatrix

;;;thatwillrotateanobjectby90degreesaboutthepoint(0,0,0).

;;;BeginbyCreatingalistoffourlists,eachcontainingfour

;;;numbers,representingtransformationmatrixelements.

(setqmatList(list'(0-100)'(1000)'(0010)'(0001)))

;;;Usevlax-tmatrixtoconvertthelisttoavariant.

(setqtransmat(vlax-tmatrixmatlist))

;;;Transformthelineusingthedefinedtransformationmatrix

(vla-transformbylineObjtransMat)

(vla-zoomallacadObject)

(princ"Thelineistransformed")

(princ)

)

Pleasesendusyourcommentaboutthispage

Page 659: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-typeinfo-available-p

DetermineswhetherTypeLibinformationispresentforthespecifiedtypeofobject

VisualLISPrequiresTypeLibinformationtodeterminewhetheramethodorpropertyisavailableforanobject.SomeobjectsmaynothaveTypeLibinformation(forexample,AcadDocument).

(vlax-typeinfo-available-pobj)

Arguments

obj

AVLA-object.

ReturnValues

T,ifTypeLibinformationisavailable;otherwisenil.

SeeAlsoThevlax-import-type-libraryfunction.

Pleasesendusyourcommentaboutthispage

Page 660: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-variant-change-type

Returnsthevalueofavariantafterchangingitfromonedatatypetoanother

(vlax-variant-change-typevartype)

Thevlax-variant-change-typefunctionreturnsthevalueofthespecifiedvariableafterconvertingthatvaluetothespecifiedvarianttype.

Arguments

var

Avariablewhosevalueisavariant.

type

Thetypeofvarianttoreturn,usingthevalueofvar(thevalueofvarisunchanged).Thetypevaluecanberepresentedbyoneofthefollowingconstants:vlax-vbEmpty(0) Uninitializedvlax-vbNull(1) Containsnovaliddatavlax-vbInteger(2) Integervlax-vbLong(3) Longintegervlax-vbSingle(4) Single-precisionfloating-pointnumbervlax-vbDouble(5) Double-precisionfloating-pointnumbervlax-vbString(8) Stringvlax-vbObject(9) Objectvlax-vbBoolean(11) Booleanvlax-vbArray(8192) ArrayTheintegershowninparenthesesindicatesthevaluetowhichtheconstantevaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,

Page 661: less than or equalAutoLISP Functions

nottheintegervalue,incasethevaluechangesinlaterreleasesofAutoCAD.

ReturnValues

Thevalueofvar,afterconvertingittothespecifiedvarianttype;otherwisenil,ifvarcouldnotbeconvertedtothespecifiedtype.

Examples

Setavariablenamedvarinttoavariantvalue:

_$(setqvarint(vlax-make-variant

5))#<variant35>

Setavariablenamedvarintstrtothevaluecontainedinvarint,butconvertthatvaluetoastring:

_$(setqvarintStr(vlax-variant-change-type

varintvlax-vbstring))#<variant85>

Checkthevalueofvarintstr:

_$(vlax-variant-valuevarintStr)"5"

Thisconfirmsthatvarintstrcontainsastring.

SeeAlsoThevlax-variant-typeandvlax-variant-valuefunctions.

Pleasesendusyourcommentaboutthispage

Page 662: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-variant-type

Determinesthedatatypeofavariant

(vlax-variant-typevar)

Arguments

var

Avariablewhosevalueisavariant.

ReturnValues

Ifvarcontainsavariant,oneofthefollowingintegersisreturned:

0Uninitialized(vlax-vbEmpty)

1Containsnovaliddata(vlax-vbNull)

2Integer(vlax-vbInteger)

3Longinteger(vlax-vbLong)

4Single-precisionfloating-pointnumber(vlax-vbSingle)

5Double-precisionfloating-pointnumber(vlax-vbDouble)

8String(vlax-vbString)

9Object(vlax-vbObject)

11Boolean(vlax-vbBoolean)

8192+nSafearray(vlax-vbArray)ofsomedatatype.Forexample,anarrayofdoubles(vlax-vbDouble)returns8197(8192+5).

Ifvardoesnotcontainavariant,anerrorresults.

Page 663: less than or equalAutoLISP Functions

Examples

Setavarianttonilanddisplaythevariant'sdatatype:

_$(setqvarnil(vlax-make-variant

nil))#<variant0>

_$(vlax-variant-typevarnil)0

Setavarianttoanintegervalueandexplicitlydefinethevariantasanintegerdatatype:

_$(setqvarint(vlax-make-variant

5vlax-vbInteger))#<variant25>

_$(vlax-variant-typevarint)2

Setavarianttoanintegervalueanddisplaythevariant'sdatatype:

_$(setqvarint(vlax-make-variant

5))#<variant35>

_$(vlax-variant-typevarint)3

Noticethatwithoutexplicitlydefiningthedatatypetovlax-variant-variant,anintegerassignmentresultsinaLongintegerdatatype.

Setavarianttoastringanddisplaythevariant'sdatatype:

_$(setqvarstr(vlax-make-variant

"ghost"))#<variant8ghost>

_$(vlax-variant-typevarstr)8

Createasafearrayofdoubles,assignthesafearraytoavariant,anddisplaythevariant'sdatatype:

_$(setq4dubs(vlax-make-safearray

Page 664: less than or equalAutoLISP Functions

vlax-vbDouble'(0.3)))#<safearray...>

_$(setqvar4dubs(vlax-make-variant

4dubs))#<variant8197...>

_$(vlax-variant-typevar4dubs)8197

Avarianttypevaluegreaterthan8192indicatesthatthevariantcontainssometypeofsafearray.Subtract8192fromthereturnvaluetodeterminethedatatypeofthesafearray.Inthisexample,8197-8192=5(vlax-vbDouble).

Assignarealvaluetoavariable,thenissuevlax-variant-typetocheckthevariable'sdatatype:

_$(setqnotvar6.0)6.0

_$(vlax-variant-typenotvar);***ERROR:badargumenttype:variantp6.0

Thislastexampleresultsinanerror,becausethevariablepassedtovlax-variant-typedoesnotcontainavariant.

SeeAlsoThevlax-make-safearray,vlax-make-variant,vlax-variant-change-type,andvlax-variant-valuefunctions.

Pleasesendusyourcommentaboutthispage

Page 665: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-variant-value

Returnsthevalueofavariant

(vlax-variant-valuevar)

Arguments

var

Avariablewhosevalueisavariant.

ReturnValues

Thevalueofthevariable.Ifthevariabledoesnotcontainavariant,anerroroccurs.

Examples

_$(vlax-variant-valuevarstr)"ghost"

_$(vlax-variant-valuevarint)5

_$(vlax-variant-valuenotvar);***ERROR:badargumenttype:variantp6.0

Thelastexampleresultsinanerror,becausenotvardoesnotcontainavariant.

SeeAlsoThevlax-make-safearrayandvlax-make-variantfunctions.

Pleasesendusyourcommentaboutthispage

Page 666: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-vla-object->ename

TransformsaVLA-objecttoanAutoLISPentity

(vlax-vla-object->enameobj)

Arguments

obj

AVLA-object.

ReturnValues

AnAutoLISPentityname(enamedatatype).

Examples

_$(vlax-vla-object->ename

vlaobj)<Entityname:27e0540>

SeeAlsoThevlax-ename->vla-objectfunction.

Pleasesendusyourcommentaboutthispage

Page 667: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlax-write-enabled-p

DeterminesifanAutoCADdrawingobjectcanbemodified

(vlax-write-enabled-pobj)

Arguments

obj

AVLA-objectorAutoLISPentityobject(ename).

ReturnValues

T,iftheAutoCADdrawingobjectcanbemodified,niliftheobjectcannotbemodified.

Pleasesendusyourcommentaboutthispage

Page 668: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlisp-compile

CompilesAutoLISPsourcecodeintoaFASfile

(vlisp-compile'mode

filename[out-filename])

Note TheVisualLISPIDEmustbeopeninorderforvlisp-compiletowork.

Arguments

mode

Thecompilermode,whichcanbeoneofthefollowingsymbols:st Standardbuildmodelsm Optimizeandlinkindirectlylsa Optimizeandlinkdirectly

filename

AstringidentifyingtheAutoLISPsourcefile.IfthesourcefileisintheAutoCADsupportfilesearchpath,youcanomitthepathwhenspecifyingthefilename.Ifyouomitthefileextension,.lspisassumed.

out-filename

Astringidentifyingthecompiledoutputfile.Ifyoudonotspecifyanoutputfile,vlisp-compilenamestheoutputwiththesamenameastheinputfile,butreplacestheextensionwith.fas.Notethatifyouspecifyanoutputfilenamebutdonotspecifyapathnameforeithertheinputortheoutputfile,vlisp-compileplacestheoutputfileintheAutoCADinstallationdirectory.

ReturnValues

T,ifcompilationissuccessful;otherwisenil.

Page 669: less than or equalAutoLISP Functions

Examples

Assumingthatyinyang.lspresidesinadirectorythatisintheAutoCADsupportfilesearchpath,thefollowingcommandcompilesthisprogram:

_$(vlisp-compile'st"yinyang.lsp")T

Theoutputfileisnamedyinyang.fasandresidesinthesamedirectoryasthesourcefile.

Thefollowingcommandcompilesyinyang.lspandnamestheoutputfileGoodKarma.fas:

(vlisp-compile'st"yinyang.lsp"

"GoodKarma.fas")

NotethattheoutputfilefromthepreviouscommandresidesintheAutoCADinstallationdirectory,notthedirectorywhereyinyang.lspresides.Thefollowingcommandcompilesyinyang.lspanddirectstheoutputfiletothec:\mydocumentsdirectory:

(vlisp-compile'st"yinyang.lsp""c:/mydocuments/GoodKarma")

Thislastexampleidentifiesthefullpathofthefiletobecompiled:

(vlisp-compile'st"c:/program

files/<AutoCADinstallationdirectory>/Sample/yinyang.lsp")

Theoutputfilefromthiscommandisnamedyinyang.fasandresidesinthesamedirectoryastheinputfile.

SeeAlsoTheCompilingaProgramfromaFiletopicintheAutoLISPDeveloper'sGuide.

Pleasesendusyourcommentaboutthispage

Page 670: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-acdb-reactor

Constructsareactorobjectthatnotifieswhenanobjectisaddedto,modifiedin,orerasedfromadrawingdatabase

Thevlr-acdb-reactorfunctionconstructsadatabasereactorobject.

(vlr-acdb-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwithareactorobject;otherwisenil,ifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Databasereactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunctionobj Thedatabaseobject(AutoLISPentity)associatedwiththeevent

Databasereactorevents

Name Event

:vlr-objectAppended Anobjecthasbeenappendedtothedrawing

Page 671: less than or equalAutoLISP Functions

database.

:vlr-objectUnAppended Anobjecthasbeendetachedfromthedrawingdatabase,e.g.,byusingUNDO.

:vlr-objectReAppended Adetachedobjecthasbeenrestoredinthedrawingdatabase,e.g.,byusingREDO.

:vlr-objectOpenedForModify Anobjectisabouttobechanged.

:vlr-objectModified Anobjecthasbeenchanged.

:vlr-objectErased Anobjecthasbeenflaggedasbeingerased.

:vlr-objectUnErased Anobject'serased-flaghasbeenremoved.

Pleasesendusyourcommentaboutthispage

Page 672: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-add

Enablesadisabledreactorobject

(vlr-addobj)

Arguments

obj

AVLRobjectrepresentingthereactortobeenabled.

ReturnValues

Theobjargument.

SeeAlsoThevlr-added-pandvlr-removefunctions.

Pleasesendusyourcommentaboutthispage

Page 673: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-added-p

Teststodetermineifareactorobjectisenabled

(vlr-added-pobj)

Arguments

obj

AVLRobjectrepresentingthereactortobetested.

ReturnValues

Tifthespecifiedreactorisenabled;otherwisenilifthereactorisdisabled.

SeeAlsoThevlr-addfunction.

Pleasesendusyourcommentaboutthispage

Page 674: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-beep-reaction

Producesabeepsound

(vlr-beep-reaction[args])

Arguments

Thisisapredefinedcallbackfunctionthatacceptsavariablenumberofarguments,dependingonthereactortype.Thefunctioncanbeassignedtoaneventhandlerfordebugging.

Pleasesendusyourcommentaboutthispage

Page 675: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-command-reactor

Constructsaneditorreactorthatnotifiesofacommandevent

(vlr-command-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodataistobeassociatedwiththereactor.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Commandreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistcontainingasingleelement,thestringidentifyingthecommand.

ReturnValues

Thereactor_objectargument.

Commandreactorevents

Eventname Description

:vlr-unknownCommand Acommandnotknownto

Page 676: less than or equalAutoLISP Functions

AutoCADwasissued.

:vlr-commandWillStart AnAutoCADcommandhasbeencalled.

:vlr-commandEnded AnAutoCADcommandhascompleted.

:vlr-commandCancelled AnAutoCADcommandhasbeencanceled.

:vlr-commandFailed AnAutoCADcommandfailedtocomplete.

Pleasesendusyourcommentaboutthispage

Page 677: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-current-reaction-name

Returnsthename(symbol)ofthecurrentevent,ifcalledfromwithinareactor'scallback

(vlr-current-reaction-name)

ReturnValues

Asymbolindicatingtheeventthattriggeredthereactor.

Pleasesendusyourcommentaboutthispage

Page 678: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-data

Returnsapplication-specificdataassociatedwithareactor

(vlr-dataobj)

Arguments

obj

AVLRobjectrepresentingthereactorobjectfromwhichtoextractdata.

ReturnValues

Theapplication-specificdataobtainedfromthereactorobject.

Examples

ThefollowingexampleobtainsastringassociatedwiththecircleReactorVLRobject:

_$(vlr-datacircleReactor)"CircleReactor"

Pleasesendusyourcommentaboutthispage

Page 679: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-data-set

Overwritesapplication-specificdataassociatedwithareactor

(vlr-data-setobjdata)

Note Thevlr-data-setfunctionshouldbeusedwithcaretoavoidcreationofcircularstructures.

Arguments

obj

AVLRobjectrepresentingthereactorobjectwhosedataistobeoverwritten.

data

AnyAutoLISPdata.

ReturnValues

Thedataargument.

Examples

Returntheapplication-specificdatavalueattachedtoareactor:

_$(vlr-datacircleReactor)"CircleReactor"

Replacethetextstringusedtoidentifythereactor:

_$(vlr-data-setcircleReactor

"CircleAreaReactor")"CircleAreaReactor"

Verifythechange:

Page 680: less than or equalAutoLISP Functions

_$(vlr-datacircleReactor)"CircleAreaReactor"

Pleasesendusyourcommentaboutthispage

Page 681: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-deepclone-reactor

Constructsaneditorreactorobjectthatnotifiesofadeepcloneevent

(vlr-deepclone-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“DeepClonereactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“DeepClonereactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

DeepClonereactorevents

Eventname Description

Page 682: less than or equalAutoLISP Functions

:vlr-beginDeepClone Adeepcloneoperationisbeginning.

:vlr-beginDeepCloneXlation Adeepcloneoperationhastwostages.First,eachobjectandanyownedobjectsarecloned.Second,anyobjectIDreferencesaretranslatedtotheirclonedIDs.Thiscallbackoccursbetweenthesetwostages.

:vlr-abortDeepClone Adeepcloneoperationisaborting.

:vlr-endDeepClone Adeepcloneoperationisending.

DeepClonereactorcallbackdata

Name Listlength Parameters

:vlr-beginDeepClone:vlr-abortDeepClone:vlr-endDeepClone

0

:vlr-beginDeepCloneXlation 1 Anintegercontainingthereturnerrorstatus;ifthisvalueindicatesanerror,thedeepcloneoperationis

Page 683: less than or equalAutoLISP Functions

terminated

Pleasesendusyourcommentaboutthispage

Page 684: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-docmanager-reactor

Constructsareactorobjectthatnotifiesofeventsrelatingtodrawingdocuments

(vlr-docmanager-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“DocManagerreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“DocManagerreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

DocManagerreactorevents

Eventname Description

Page 685: less than or equalAutoLISP Functions

:vlr-documentCreated Anewdocumentwascreatedforadrawing(neworopen).Usefulforupdatingyourper-documentstructures.

:vlr-documentToBeDestroyed Adocumentwillbedestroyed.

:vlr-documentLockModeWillChange Acommandisabouttostartorfinishmodifyingelementsinthedocument,andisobtainingorreleasingalockonthedocument.

:vlr-documentLockModeChangeVetoed Areactorinvokedvetoonitselffroma:vlr-documentLockModeChangedcallback.

:vlr-documentLockModeChanged Thelockonthedocumenthasbeenobtainedorreleased.

:vlr-documentBecameCurrent Thecurrentdocumenthasbeenchanged.Thisdoesnotnecessarilyimplythatthedocumenthasbeenactivated,becausechangingthecurrentdocumentisnecessaryforsomeoperations.Toobtainuserinput,thedocumentmustbeactivatedaswell.

:vlr-documentToBeActivated Acurrentlyinactivedocumenthasjustreceivedtheactivatesignal,implyingthatitisabouttobecomethecurrentdocument.

:vlr-documentToBeDeactivated Anotherwindow(insideor

Page 686: less than or equalAutoLISP Functions

outsideofAutoCAD)hasbeenactivated.

DocManagerreactorcallbackdata

Name Listlength Parameters

:vlr-documentCreated:vlr-documentToBeDestroyed:vlr-documentBecameCurrent:vlr-documentToBeActivated:vlr-documentToBeDeactivated

1 Theaffecteddocumentobject(VLA-object).

:vlr-documentLockModeChangeVetoed 2 Firstparameteristheaffecteddocumentobject(VLA-object).Secondparameteristheglobalcommandstringpassedinforthelockrequest.Ifthecallbackisbeingmadeonbehalfofanunlockrequest,thestringwillbeprefixedwith“#”.

Page 687: less than or equalAutoLISP Functions

:vlr-documentLockModeWillChange:vlr-documentLockModeChanged

5 Firstparameteristheaffecteddocumentobject(VLA-object).Secondparameterisanintegerindicatingthelockcurrentlyineffectforthedocumentobject.Thirdparameterisanintegerindicatingthelockmodethatwillbeineffectafterthelockisapplied.Fourthparameteristhestrongestlockmodefromallotherexecutioncontexts.Fifthparameteristheglobalcommandstringpassedinforthelockrequest.Ifthecallbackisbeingmadeonbehalfofanunlockrequest,thestringwillbeprefixedwith

Page 688: less than or equalAutoLISP Functions

“#”.Lockmodesmaybeanyofthefollowing:1—AutoWriteLock2—NotLocked4—SharedWrite8—Read10—ExclusiveWrite

Pleasesendusyourcommentaboutthispage

Page 689: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-dwg-reactor

Constructsaneditorreactorobjectthatnotifiesofadrawingevent(forexample,openingorclosingadrawingfile)

(vlr-dwg-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“DWGreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventoccurs.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“DWGreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

DWGreactorevents

Eventname Description

Page 690: less than or equalAutoLISP Functions

:vlr-beginClose Thedrawingdatabaseistobeclosed.

:vlr-databaseConstructed Adrawingdatabasehasbeenconstructed.

:vlr-databaseToBeDestroyed Thecontentsofthedrawingdatabaseareabouttobedeletedfrommemory.

vlr-beginDwgOpen AutoCADisabouttoopenadrawingfile.

:vlr-endDwgOpen AutoCADhasendedtheopenoperation.

:vlr-dwgFileOpened AnewdrawinghasbeenloadedintotheAutoCADwindow.

vlr-beginSave AutoCADisabouttosavethedrawingfile.

vlr-saveComplete AutoCADhassavedthecurrentdrawingtodisk.

DWGreactorcallbackdata

Name Listlength Parameters

:vlr-beginClose:vlr-databaseConstructed

0

Page 691: less than or equalAutoLISP Functions

:vlr-databaseToBeDestroyed

:vlr-beginDwgOpen:vlr-endDwgOpen:vlr-dwgFileOpened

1 Astringidentifyingthefiletoopen.

:vlr-beginSave 1 Astringcontainingthedefaultfilenameforsave;maybechangedbytheuser.

:vlr-saveComplete 1 Astringcontainingtheactualfilenameusedforthesave.

Pleasesendusyourcommentaboutthispage

Page 692: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-dxf-reactor

ConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtoreadingorwritingaDXFfile

(vlr-dxf-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“DXFreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“DXFreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

DXFreactorevents

Eventname Description

Page 693: less than or equalAutoLISP Functions

:vlr-beginDxfIn ThecontentsofaDXFfilearetobeappendedtothedrawingdatabase.

:vlr-abortDxfIn TheDXFimportwasnotsuccessful.

:vlr-dxfInComplete TheDXFimportwassuccessful.

:vlr-beginDxfOut AutoCADisabouttoexportthedrawingdatabaseintoaDXFfile.

:vlr-abortDxfOut TheDXFexportoperationfailed.

:vlr-dxfOutComplete TheDXFexportoperationwassuccessful.

DXFreactorcallbackdata

Name Listlength

:vlr-beginDxfIn:vlr-abortDxfIn:vlr-dxfInComplete,:vlr-beginDxfOut:vlr-abortDxfOut:vlr-dxfOutComplete

0

Page 694: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 695: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-editor-reactor

Constructsaneditorreactorobject

(vlr-editor-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Editorreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Editorreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Editorreactorevents

Eventname Description

Page 696: less than or equalAutoLISP Functions

:vlr-beginClose Thedrawingdatabaseistobeclosed.

:vlr-beginDxfIn ThecontentsofaDXFfilearetobeappendedtothedrawingdatabase.

:vlr-abortDxfIn TheDXFimportwasnotsuccessful.

:vlr-dxfInComplete TheDXFimportcompletedsuccessfully.

:vlr-beginDxfOut AutoCADisabouttoexportthedrawingdatabaseintoaDXFfile.

:vlr-abortDxfOut DXFexportoperationfailed.

:vlr-dxfOutComplete DXFexportoperationcompletedsuccessfully.

:vlr-databaseToBeDestroyed Thecontentsofthedrawingdatabaseareabouttobedeletedfrommemory.

:vlr-unknownCommand AcommandnotknowntoAutoCADwasissued.

:vlr-commandWillStart AnAutoCADcommandhasbeencalled.

vlr-commandEnded AnAutoCADcommandhascompleted.

:vlr-commandCancelled AnAutoCADcommandhasbeencanceled.

Page 697: less than or equalAutoLISP Functions

:vlr-commandFailed AnAutoCADcommandfailedtocomplete.

:vlr-lispWillStart AnAutoLISPexpressionistobeevaluated.

:vlr-lispEnded EvaluationofanAutoLISPexpressionhascompleted.

:vlr-lispCancelled EvaluationofanAutoLISPexpressionhasbeencanceled.

:vlr-beginDwgOpen AutoCADisabouttoopenadrawingfile.

:vlr-endDwgOpen AutoCADhasendedtheopenoperation.

:vlr-dwgFileOpened AnewdrawinghasbeenloadedintotheAutoCADwindow.

:vlr-beginSave AutoCADisabouttosavethedrawingfile.

:vlr-saveComplete AutoCADhassavedthecurrentdrawingtodisk.

:vlr-sysVarWillChange AutoCADisabouttochangethevalueofasystemvariable.

:vlr-sysVarChanged Thevalueofasystemvariablehaschanged.

Page 698: less than or equalAutoLISP Functions

Editorreactorcallbackdata

Name Listlength Parameters

:vlr-lispEnded:vlr-lispCancelled:vlr-beginClose:vlr-beginDxfIn:vlr-abortDxfIn:vlr-dxfInComplete:vlr-beginDxfOut:vlr-abortDxfOut:vlr-dxfOutComplete:vlr-databaseToBeDestroyed

0

:vlr-unknownCommand:vlr-commandWillStart:vlr-commandEnded:vlr-commandCancelled:vlr-commandFailed

1 Astringcontainingthecommandname.

:vlr-lispWillStart 1 AstringcontainingthefirstlineoftheAutoLISPexpressiontoevaluate.

:vlr-beginDwgOpen:vlr-endDwgOpen

1 Astringidentifyingthefiletoopen.

Page 699: less than or equalAutoLISP Functions

:vlr-dwgFileOpened

:vlr-beginSave 1 Astringcontainingthedefaultfilenameforsave;thismaybechangedbytheuser.

:vlr-saveComplete 1 Astringidentifyingtheactualfilenameusedforthesave.

:vlr-sysVarWillChange 1 Astringnamingthesystemvariable.

:vlr-sysVarChanged 2 Firstparameterisastringnamingthesystemvariable.Secondparameterisanintegerindicatingwhetherthechangewassuccessful(1=success,0=failed).

Pleasesendusyourcommentaboutthispage

Page 700: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-insert-reactor

Constructsaneditorreactorobjectthatnotifiesofaneventrelatedtoblockinsertion

(vlr-insert-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Insertreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsisshowninthe“Insertreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Insertreactorevents

Eventname Description

Page 701: less than or equalAutoLISP Functions

:vlr-beginInsert Ablockisabouttobeinsertedintothedrawingdatabase.

:vlr-beginInsertM A3Dtransformationmatrixisabouttobeinsertedintothedrawingdatabase.

:vlr-otherInsert Ablockormatrixhasbeenaddedtothedrawingdatabase.Thisnotificationissentaftertheinsertprocesscompletescopyingtheobjectintothedatabase,butbeforeIDtranslationorentitytransformationoccurs.

:vlr-endInsert Usuallyindicatesaninsertoperationonthedrawingdatabaseiscomplete.However,insomecases,thetransformhasnotyethappened,ortheblockthatwascreatedhasnotyetbeenappended.Thismeanstheobjectscopiedarenotyetgraphical,andyoucannotusetheminselectionsetsuntilthe:vlr-commandEndednotificationisreceived.

:vlr-abortInsert Insertoperationwasterminatedanddidnotcomplete,leavingthedatabaseinanunstablestate.

Insertreactorcallbackdata

Name Listlength Parameters

:vlr-beginInsert

3 FirstparameterisaVLA-objectpointingtothedatabaseinwhichtheblockis

Page 702: less than or equalAutoLISP Functions

beinginserted.Secondparameterisastringnamingtheblocktobeinserted.ThirdparameterisaVLA-objectidentifyingthesourcedatabaseoftheblock.

:vlr-beginInsertM

3 FirstparameterisaVLA-objectpointingtothedatabaseinwhichthe3Dtransformationmatrixisbeinginserted.Secondparameteristhe3Dtransformationmatrixtobeinserted.ThirdparameterisaVLA-objectidentifyingthesourcedatabaseofthematrix.

:vlr-otherInsert 2 FirstparameterisaVLA-objectpointingtothedatabaseinwhichtheblockormatrixisbeinginserted.SecondparameterisaVLA-objectidentifyingthesourcedatabaseoftheblockormatrix.

Page 703: less than or equalAutoLISP Functions

:vlr-endInsert:vlr-abortInsert

1 VLA-objectpointingtotargetdatabase.

Pleasesendusyourcommentaboutthispage

Page 704: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-linker-reactor

ConstructsareactorobjectthatnotifiesyourapplicationeverytimeanObjectARXapplicationisloadedorunloaded

(vlr-linker-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Linkerreactorevents”table,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list AlistcontainingthenameoftheObjectARXprogramthatwasloadedorunloaded(astring).

ReturnValues

Thereactor_objectargument.

Linkerreactorevents

Name Event

:vlr-rxAppLoaded Thedynamiclinkerhasloaded

Page 705: less than or equalAutoLISP Functions

anewObjectARXprogram.Theprogramhasfinisheditsinitialization.

:vlr-rxAppUnLoaded ThedynamiclinkerhasunloadedanObjectARXprogram.Theprogramalreadyhasdoneitsclean-up.

Examples

_$(vlr-linker-reactornil

'((:vlr-rxAppLoaded

.my-vlr-trace-reaction)))#<VLR-Linker-Reactor>

Pleasesendusyourcommentaboutthispage

Page 706: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-lisp-reactor

ConstructsaneditorreactorobjectthatnotifiesofaLISPevent

(vlr-lisp-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Lispreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.ThecontentsofthislistforparticulareventsareshowninthetableLispreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Lispreactorevents

Eventname Description

Page 707: less than or equalAutoLISP Functions

:vlr-lispWillStart AnAutoLISPexpressionistobeevaluated.

:vlr-lispEnded EvaluationofanAutoLISPexpressionhasbeencompleted.

:vlr-lispCancelled EvaluationofanAutoLISPexpressionhasbeencanceled.

Lispreactorcallbackdata

Name Listlength Parameters

:vlr-lispEnded:vlr-lispCancelled

0

:vlr-lispWillStart 1 AstringcontainingthefirstlineoftheAutoLISPexpressiontoevaluate.

Pleasesendusyourcommentaboutthispage

Page 708: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-miscellaneous-reactor

Constructsaneditorreactorobjectthatdoesnotfallunderanyothereditorreactortypes

(vlr-miscellaneous-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Miscellaneousreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Miscellaneousreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Miscellaneousreactorevents

Page 709: less than or equalAutoLISP Functions

Eventname Description

:vlr-pickfirstModified Thepickfirstselectionsetofthecurrentdocumenthasbeenmodified.

:vlr-layoutSwitched Thelayoutwasswitched.

Miscellaneousreactorcallbackdata

Name Listlength Parameters

:vlr-pickfirstModified 0

:vlr-layoutSwitched 1 Astringnamingthelayoutswitchedto.

Pleasesendusyourcommentaboutthispage

Page 710: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-mouse-reactor

Constructsaneditorreactorobjectthatnotifiesofamouseevent(forexample,adouble-click)

(vlr-mouse-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Mousereactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Mousereactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Mousereactorevents

Eventname Description

Page 711: less than or equalAutoLISP Functions

:vlr-beginDoubleClick Theuserhasdouble-clicked.

:vlr-beginRightClick Theuserhasright-clicked.

Mousereactorcallbackdata

Name Listlength Parameters

:vlr-beginDoubleClick:vlr-beginRightClick

1 A3Dpointlist(listof3reals)showingthepointclickedon,inWCS.

Pleasesendusyourcommentaboutthispage

Page 712: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-notification

Determineswhetherornotareactorwillfireifitsassociatednamespaceisnotactive

(vlr-notificationreactor)

Arguments

reactor

AVLRobject.

ReturnValues

Asymbol,whichcanbeeither'all-documents(thereactorfireswhetherornotitsassociateddocumentisactive),or'active-document-only(thereactorfiresonlyifitsassociateddocumentisactive).

Pleasesendusyourcommentaboutthispage

Page 713: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-object-reactor

Constructsadrawingobjectreactorobject

(vlr-object-reactorownersdatacallbacks)

Thereactorobjectisaddedtothedrawingdatabase,butdoesnotbecomepersistent.

Arguments

owners

AnAutoLISPlistofVLA-objectsidentifyingthedrawingobjectstobewatched.

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“ObjectEvents”tableandcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptsthreearguments:owner TheowneroftheVLA-objecttheeventappliesto.reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“ObjectEventsCallbackData”table.

ReturnValues

Page 714: less than or equalAutoLISP Functions

Thereactor_objectargument.

Objectevents

Name Event

:vlr-cancelled Themodificationoftheobjecthasbeencanceled.

:vlr-copied Theobjecthasbeencopied.

:vlr-erased Erase-flagoftheobjecthasbeenset.

:vlr-unerased Erase-flagoftheobjecthasbeenreset.

:vlr-goodbye Theobjectisabouttobedeletedfrommemory.

:vlr-openedForModify Theobjectisabouttobemodified.

:vlr-modified Theobjecthasbeenmodified.Ifthemodificationwascanceled,also:vlr-cancelledand:vlr-modifyUndonewillbefired.

:vlr-subObjModified Asub-entityoftheobjecthasbeenmodified.Thiseventistriggeredformodificationstoverticesofpolylinesormeshes,andforattributesownedbyblockReferences.

:vlr-modifyUndone Theobject'smodificationwas

Page 715: less than or equalAutoLISP Functions

undone.

:vlr-modifiedXData Theobject'sextendedentitydatahasbeenmodified.

:vlr-unappended Theobjecthasbeendetachedfromthedrawingdatabase.

:vlr-reappended Theobjecthasbeenre-attachedtothedrawingdatabase.

:vlr-objectClosed Theobject'smodificationhasbeenfinished.

Objecteventscallbackdata

Name Listlength Parameters

:vlr-cancelled:vlr-erased,:vlr-unerased:vlr-goodbye:vlr-openedForModify:vlr-modified:vlr-modifyUndone:vlr-modifiedXData:vlr-unappended:vlr-reappended:vlr-objectClosed

0

Page 716: less than or equalAutoLISP Functions

:vlr-copied 1 Theobjectcreatedbythecopyoperation(ename).

:vlr-subObjModified 1 Thesub-object(ename)thathasbeenmodified

Examples

ThefollowingcodeattachesanobjectreactortothemyCircleobject.Itdefinesthereactortorespondwhenevertheobjectismodified(:vlr-modified)andtocalltheprint-radiusfunctioninresponsetothemodificationevent:

(setqcircleReactor(vlr-object-reactor(listmyCircle)

"CircleReactor"'((:vlr-modified.print-radius))))

Pleasesendusyourcommentaboutthispage

Page 717: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-owner-add

Addsanobjecttothelistofownersofanobjectreactor

(vlr-owner-addreactorowner)

Thisfunctionaddsanewsourceofreactorevents;thereactorwillreceiveeventsfromthespecifiedobject.

Arguments

reactor

AVLRobject.

owner

AVLA-objecttobeaddedtothelistofnotifiersforthisreactor.

ReturnValues

TheVLA-objecttowhichthereactorhasbeenadded.

Examples

Inthefollowingexample,anarcobjectnamed“archie”isaddedtotheownerlistofreactorcircleReactor:

_$(vlr-owner-addcircleReactor

archie)#<VLA-OBJECTIAcadArc03ad0bcc>

SeeAlsoThevlr-owner-removefunction.

Page 718: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 719: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-owner-remove

Removesanobjectfromthelistofownersofanobjectreactor

(vlr-owner-removereactorowner)

Arguments

reactor

AVLRobject.

owner

AVLA-objecttoberemovedfromthelistofnotifiersforthisreactor.

ReturnValues

TheVLA-objectfromwhichthereactorwasremoved.

Examples

_$(vlr-owner-removecircleReactor

archie)#<VLA-OBJECTIAcadArc03ad0bcc>

SeeAlsoThevlr-owner-addfunction.

Pleasesendusyourcommentaboutthispage

Page 720: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-owners

Returnsthelistofownersofanobjectreactor

(vlr-ownersreactor)

Arguments

reactor

AVLRobject.

ReturnValues

Alistofobjectsthatnotifythespecifiedreactor.

Examples

_$(vlr-ownerscircleReactor)(#<VLA-OBJECTIAcadCircle01db98f4>#<VLA-OBJECTIAcadCircle01db9724>#<VLA-OBJECTIAcadCircle01db93d4>#<VLA-OBJECTIAcadCircle01db9084>)

Pleasesendusyourcommentaboutthispage

Page 721: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-pers

Makesareactorpersistent

(vlr-persreactor)

Arguments

reactor

AVLRobject.

ReturnValues

Thespecifiedreactorobject,ifsuccessful;otherwisenil.

Examples

Defineareactor:

_$(setqcircleReactor(vlr-object-reactor

(listmyCircle)"Radius

size"'((:vlr-modified.print-radius))))#<VLR-Object-Reactor>

Makethereactorpersistent:

_$(vlr-perscircleReactor)#<VLR-Object-Reactor>

Pleasesendusyourcommentaboutthispage

Page 722: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-pers-list

Returnsalistofpersistentreactorsinthecurrentdrawingdocument

(vlr-pers-list[reactor])

Arguments

reactor

Thereactorobjecttobelisted.Ifreactorisnotspecified,vlr-pers-listlistsallpersistentreactors.

ReturnValues

Alistofreactorobjects.

Examples

_$(vlr-pers-list)(#<VLR-Object-Reactor>#<VLR-Object-Reactor>(#<VLR-Object-Reactor>)

Pleasesendusyourcommentaboutthispage

Page 723: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-pers-p

Determineswhetherareactorispersistent

(vlr-pers-preactor)

Arguments

reactor

AVLRobject.

ReturnValues

Thespecifiedreactorobject,ifitispersistent;nil,ifthereactoristransient.

Examples

Makeareactorpersistent:

_$(vlr-perscircleReactor)#<VLR-Object-Reactor>

Verifythatareactorispersistent:

_$(vlr-pers-pcircleReactor)#<VLR-Object-Reactor>

Changethepersistentreactortotransient:

_$(vlr-pers-releasecircleReactor)#<VLR-Object-Reactor>

Verifythatthereactorisnolongerpersistent:

_$(vlr-pers-pcircleReactor)

Page 724: less than or equalAutoLISP Functions

nil

Pleasesendusyourcommentaboutthispage

Page 725: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-pers-release

Makesareactortransient

(vlr-pers-releasereactor)

Arguments

reactor

VLRobject.

ReturnValues

Thespecifiedreactorobject,ifsuccessful;otherwisenil.

Pleasesendusyourcommentaboutthispage

Page 726: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-reaction-name

Returnsalistofallpossiblecallbackconditionsforthisreactortype

(vlr-reaction-namesreactor-type)

Arguments

reactor-type

Oneofthefollowingsymbols::VLR-AcDb-Reactor:VLR-Command-Reactor:VLR-DeepClone-Reactor:VLR-DocManager-Reactor:VLR-DWG-Reactor:VLR-DXF-Reactor:VLR-Editor-Reactor:VLR-Insert-Reactor:VLR-Linker-Reactor:VLR-Lisp-Reactor:VLR-Miscellaneous-Reactor:VLR-Mouse-Reactor:VLR-Object-Reactor:VLR-SysVar-Reactor:VLR-Toolbar-Reactor:VLR-Undo-Reactor:VLR-Wblock-Reactor:VLR-Window-Reactor

Page 727: less than or equalAutoLISP Functions

:VLR-XREF-Reactor

ReturnValues

Alistofsymbolsindicatingthepossibleeventsforthespecifiedreactortype.

Examples

_$(vlr-reaction-names:VLR-Editor-Reactor)(:vlr-unknownCommand:vlr-commandWillStart:vlr-commandEnded....

Pleasesendusyourcommentaboutthispage

Page 728: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-reaction-set

Addsorreplacesacallbackfunctioninareactor

(vlr-reaction-setreactoreventfunction)

Arguments

reactor

AVLRobject.

event

Asymboldenotingoneoftheeventtypesavailableforthisreactortype.

function

AsymbolrepresentingtheAutoLISPfunctiontobeaddedorreplaced.

ReturnValues

Unspecified.

Examples

ThefollowingcommandchangesthecircleReactorreactortocalltheprint-areafunctionwhenanobjectismodified:

_$(vlr-reaction-setcircleReactor

:vlr-modified'print-area)PRINT-AREA

Pleasesendusyourcommentaboutthispage

Page 729: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-reactions

Returnsalistofpairs(event-name.callback_function)forthereactor

(vlr-reactionsreactor)

Arguments

reactor

AVLRobject.

Examples

_$(vlr-reactionscircleReactor)((:vlr-modified.PRINT-RADIUS))

Pleasesendusyourcommentaboutthispage

Page 730: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-reactors

Returnsalistofexistingreactors

(vlr-reactors[reactor-type...])

Arguments

reactor-type

Oneormoreofthefollowingsymbols::VLR-AcDb-Reactor:VLR-Command-Reactor:VLR-DeepClone-Reactor:VLR-DocManager-Reactor:VLR-DWG-Reactor:VLR-DXF-Reactor:VLR-Editor-Reactor:VLR-Insert-Reactor:VLR-Linker-Reactor:VLR-Lisp-Reactor:VLR-Miscellaneous-Reactor:VLR-Mouse-Reactor:VLR-Object-Reactor:VLR-SysVar-Reactor:VLR-Toolbar-Reactor:VLR-Undo-Reactor:VLR-Wblock-Reactor:VLR-Window-Reactor

Page 731: less than or equalAutoLISP Functions

:VLR-XREF-Reactor

Ifyouspecifyreactor-typearguments,vlr-reactorsreturnslistsofthereactortypesyouspecified.Ifyouomitreactor-type,vlr-reactorsreturnsallexistingreactors.

ReturnValues

Alistofreactorlists;otherwisenil,iftherearenoreactorsofanyspecifiedtype.Eachreactorlistbeginswithasymbolidentifyingthereactortype,followedbypointerstoeachreactorofthattype.

Examples

Listallreactorsinadrawing:

_$(vlr-reactors)((:VLR-Object-Reactor#<VLR-Object-Reactor>)(:VLR-Editor-Reactor#<VLR-Editor-Reactor>))

Listallobjectreactors:

_$(vlr-reactors:vlr-object-reactor)((:VLR-Object-Reactor#<VLR-Object-Reactor>))

vlr-reactorsreturnsalistcontainingasinglereactorlist.

Listalldatabasereactors:

_$(vlr-reactors:vlr-acdb-reactor)nil

Therearenodatabasereactorsdefined.

ListallDWGreactors:

_$(vlr-reactors:vlr-dwg-reactor)((:VLR-DWG-Reactor#<VLR-DWG-Reactor>#<VLR-DWG-Reactor>))

vlr-reactorsreturnsalistcontainingalistofDWGreactors.

Pleasesendusyourcommentaboutthispage

Page 732: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-remove

Disablesareactor

(vlr-removereactor)

Arguments

reactor

AVLRobject.

ReturnValues

Thereactorargument;otherwisenil,ifunsuccessful.

Examples

ThefollowingcommanddisablesthecircleReactorreactor:

_$(vlr-removecircleReactor)#<VLR-Object-reactor>

SeeAlsoThevlr-remove-allfunction.

Pleasesendusyourcommentaboutthispage

Page 733: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-remove-all

Disablesallreactorsofthespecifiedtype

(vlr-remove-all[reactor-type])

Arguments

reactor-type

Oneofthefollowingsymbols::VLR-AcDb-Reactor:VLR-Command-Reactor:VLR-DeepClone-Reactor:VLR-DocManager-Reactor:VLR-DWG-Reactor:VLR-DXF-Reactor:VLR-Editor-Reactor:VLR-Insert-Reactor:VLR-Linker-Reactor:VLR-Lisp-Reactor:VLR-Miscellaneous-Reactor:VLR-Mouse-Reactor:VLR-Object-Reactor:VLR-SysVar-Reactor:VLR-Toolbar-Reactor:VLR-Undo-Reactor:VLR-Wblock-Reactor:VLR-Window-Reactor

Page 734: less than or equalAutoLISP Functions

:VLR-XREF-ReactorIfnoreactor-typeisspecified,vlr-remove-alldisablesallreactors.

ReturnValues

Alistoflists.Thefirstelementofeachlistidentifiesthetypeofreactor,andtheremainingelementsidentifythedisabledreactorobjects.Thefunctionreturnsniliftherearenoreactorsactive.

Examples

Thefollowingfunctioncalldisablesalleditorreactors:

_$(vlr-remove-all:vlr-editor-reactor)((:VLR-Editor-Reactor#<VLR-Editor-Reactor>))

Thefollowingcalldisablesallreactors:

_$(vlr-remove-all)((:VLR-Object-Reactor#<VLR-Object-Reactor>#<VLR-Object-Reactor>

#<VLR-Object-Reactor>)(:VLR-Editor-Reactor#<VLR-Editor-Reactor>))

SeeAlsoThevlr-removefunction.

Pleasesendusyourcommentaboutthispage

Page 735: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-set-notification

Defineswhetherareactor'scallbackfunctionwillexecuteifitsassociatednamespaceisnotactive

(vlr-set-notificationreactor'range)

Arguments

reactor

AVLRobject.

'range

Therangeargumentisasymbolthatcanbeeither'all-documents(executethecallbackregardlessofwhetherthereactorisassociatedwiththeactivedocument),or'active-document-only(executethecallbackonlyifthereactorisassociatedwiththeactivedocument).

ReturnValues

TheVLRobject.

Examples

Setareactortoexecuteitscallbackfunctionevenifitsassociatednamespaceisnotactive:

_$(vlr-set-notification

circleReactor'all-documents)#<VLR-Object-Reactor>

Pleasesendusyourcommentaboutthispage

Page 736: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-sysvar-reactor

Constructsaneditorreactorobjectthatnotifiesofachangetoasystemvariable

(vlr-sysvar-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“SysVarreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“SysVarreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

SysVarreactorevents

Eventname Description

Page 737: less than or equalAutoLISP Functions

:vlr-sysVarWillChange AutoCADisabouttochangethevalueofasystemvariable.

:vlr-sysVarChanged Thevalueofasystemvariablehaschanged.

SysVarreactorcallbackdata

Name Listlength Parameters

:vlr-sysVarWillChange 1 Astringidentifyingthesystemvariablename.

:vlr-sysVarChanged 2 Firstparameterisastringidentifyingthesystemvariablename.Secondparameterissymbolindicatingwhetherthechangewassuccessful(Tifsuccessful,nilifnot).

Pleasesendusyourcommentaboutthispage

Page 738: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-toolbar-reactor

Constructsaneditorreactorobjectthatnotifiesofachangetothebitmapsinatoolbar

(vlr-toolbar-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Toolbarreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Toolbarreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Toolbarreactorevents

Eventname Description

Page 739: less than or equalAutoLISP Functions

:vlr-toolbarBitmapSizeWillChange ThesizeoftheAutoCADtoolbariconsisabouttochange.

:vlr-toolbarBitmapSizeChanged ThesizeoftheAutoCADtoolbariconshaschanged.

Toolbarreactorcallbackdata

Name Listlength Parameters

:vlr-toolbarBitmapSizeWillChange:vlr-toolbarBitmapSizeChanged

1 T,ifthetoolbarisbeingsettolargebitmaps;nilifthetoolbarisbeingsettosmallbitmaps.

Pleasesendusyourcommentaboutthispage

Page 740: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-trace-reaction

ApredefinedcallbackfunctionthatprintsoneormorecallbackargumentsintheTracewindow

(vlr-trace-reaction)

Thisfunctioncanbeusedasadebuggingtooltoverifythatareactorhasfired.

Examples

Defineacommandreactorandassignvlr-trace-reactionasthecallbackfunction:

_$(VLR-Reaction-Set

(VLR-Command-Reactor):VLR-commandWillStart'VLR-trace-reaction)VLR-trace-reaction

AttheAutoCADCommandprompt,enterthefollowing:

_.LINE

Respondtothecommandprompts,thenactivatetheVLISPwindowandopentheTracewindow.YoushouldseethefollowingintheTracewindow:

;"Reaction"::VLR-commandWillStart;"argumentlist":(#<VLR-COMMAND-REACTOR>("LINE"))

Theoutputfromvlr-trace-reactionidentifiesthetypeoftriggerevent,thereactortype,andthecommandthattriggeredthereactor.

Pleasesendusyourcommentaboutthispage

Page 741: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-type

Returnsasymbolrepresentingthereactortype

(vlr-typereactor)

Arguments

reactor

AVLRobject.

ReturnValues

Asymbolidentifyingthereactortype.Thefollowingtableliststhetypesthatmaybereturnedbyvlr-type:

Reactortypes

Reactortype Description

:VLR-AcDb-Reactor Databasereactor.

:VLR-Command-Reactor Aneditorreactornotifyingofacommandevent.

:VLR-DeepClone-Reactor

Aneditorreactornotifyingofadeepcloneevent.

:VLR-DocManager-Reactor

Documentmanagementreactor.

:VLR-DWG-Reactor Aneditorreactornotifyingofadrawingevent

Page 742: less than or equalAutoLISP Functions

(forexample,openingorclosingadrawingfile).

:VLR-DXF-Reactor AneditorreactornotifyingofaneventrelatedtoreadingorwritingofaDXFfile.

:VLR-Editor-Reactor Generaleditorreactor;maintainedforbackwardcompatibility.

:VLR-Insert-Reactor Aneditorreactornotifyingofaneventrelatedtoblockinsertion.

:VLR-Linker-Reactor Linkerreactor.

:VLR-Lisp-Reactor AneditorreactornotifyingofaLISPevent.

:VLR-Miscellaneous-Reactor

Aneditorreactorthatdoesnotfallunderanyoftheothereditorreactortypes.

:VLR-Mouse-Reactor Aneditorreactornotifyingofamouseevent(forexample,adouble-click).

:VLR-Object-Reactor Objectreactor.

:VLR-SysVar-Reactor Aneditorreactornotifyingofachangetoasystemvariable.

:VLR-Toolbar-Reactor Aneditorreactornotifyingofachangetothebitmapsinatoolbar.

:VLR-Undo-Reactor Aneditorreactornotifyingofanundoevent.

:VLR-Wblock-Reactor Aneditorreactornotifyingofaneventrelatedtowritingablock.

:VLR-Window-Reactor AneditorreactornotifyingofaneventrelatedtomovingorsizinganAutoCADwindow.

Page 743: less than or equalAutoLISP Functions

:VLR-XREF-Reactor AneditorreactornotifyingofaneventrelatedtoattachingormodifyingXREFs.

Examples

_$(vlr-typecircleReactor):VLR-Object-Reactor

Pleasesendusyourcommentaboutthispage

Page 744: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-types

Returnsalistofallreactortypes

(vlr-types)

ReturnValues

(:VLR-Linker-Reactor:VLR-Editor-Reactor:VLR-AcDb-Reactor....)

Pleasesendusyourcommentaboutthispage

Page 745: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-undo-reactor

Constructsaneditorreactorobjectthatnotifiesofanundoevent

(vlr-undo-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Undoreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Undoreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Undoreactorevents

Eventname Description

Page 746: less than or equalAutoLISP Functions

:vlr-undoSubcommandAuto TheUNDOcommand'sAutooptionhasbeenexecuted.

:vlr-undoSubcommandControl TheUNDOcommand'sControloptionhasbeenexecuted.

:vlr-undoSubcommandBegin TheUNDOcommand'sBEGINorGROUPoptionisbeingperformed.BEGINandGROUPmarkthebeginningofaseriesofcommandsthatcanbeundoneasoneunit.

:vlr-undoSubcommandEnd TheUNDOcommand'sENDoptionisbeingperformed.UNDO/ENDmarkstheendofaseriesofcommandsthatcanbeundoneasoneunit.

:vlr-undoSubcommandMark TheUNDOcommand'sMARKoptionisabouttobeexecuted.ThisplacesamarkerintheundofilesoUNDO/BACKcanundobacktothemarker.

:vlr-undoSubcommandBack TheUNDOcommand'sBACKoptionisabouttobeperformed.UNDO/BACKundoeseverythingbacktothemostrecentMARKmarkerorbacktothebeginningof

Page 747: less than or equalAutoLISP Functions

theundofileifnoMARKmarkerexists.

:vlr-undoSubcommandNumber TheUNDOcommand'sNUMBERoptionisabouttobeexecuted(thedefaultactionoftheUNDOcommand).

Undoreactorcallbackdata

Name Listlength Parameters

:vlr-undoSubcommandAuto 2 Firstparameterisanintegerindicatingtheactivity.Thevalueisalways4,indicatingthatnotificationoccurredaftertheoperationwasperformed.SecondparameterisasymbolindicatingthestateofAutomode.ValueisTifAutomodeisturnedon,nilifAutomodeisturnedoff.

:vlr-undoSubcommandControl 2 Firstparameterisanintegerindicatingtheactivity.Thevalueis

Page 748: less than or equalAutoLISP Functions

always4,indicatingthatnotificationoccurredaftertheoperationwasperformed.SecondparameterisanintegerindicatingtheControloptionselected.Thiscanbeoneofthefollowing:0—NONEwasselected1—ONEwasselected2—ALLwasselected

:vlr-undoSubcommandBegin:vlr-undoSubcommandEnd:vlr-undoSubcommandMark:vlr-undoSubcommandBack

1 Anintegervalueof0,indicatingthatnotificationoccursbeforetheactualoperationisperformed.

:vlr-undoSubcommandNumber 2 Firstparameterisanintegerindicatingtheactivity.Thevalueisalways0,indicatingthatnotificationoccursbeforetheactualoperationisperformed.Secondparameterisanintegerindicatingthenumberofsteps

Page 749: less than or equalAutoLISP Functions

beingundone.

Pleasesendusyourcommentaboutthispage

Page 750: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-wblock-reactor

Constructsaneditorreactorobjectthatnotifiesofaneventrelatedtowritingablock

(vlr-wblock-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Wblockreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Wblockreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Wblockreactorevents

Eventname Description

Page 751: less than or equalAutoLISP Functions

:VLR-wblockNotice Awblockoperationisabouttostart.

:VLR-beginWblockPt Awblockoperationisbeingperformedonasetofentities.

:VLR-beginWblockId Awblockoperationisbeingperformedonaspecifiedblock.

:VLR-beginWblock Awblockoperationisbeingperformedonanentiredatabase.Notificationdoesnotoccuruntilalltheentitiesinthesourcedatabase'smodelspacearecopiedintothetargetdatabase.

:VLR-endWblock Awblockoperationcompletedsuccessfully.

:VLR-beginWblockObjects wblockhasjustinitializedtheobjectIDtranslationmap.

Wblockreactorcallbackdata

Name Listlength Parameters

:VLR-wblockNotice 1 Databaseobject(VLA-object)fromwhichtheblockwill

Page 752: less than or equalAutoLISP Functions

becreated.

:VLR-beginWblockPt 3 Firstparameteristhetargetdatabaseobject(VLA-object).Secondparameteristhesourcedatabaseobject(VLA-object)containingtheobjectsbeingwblocked.Thirdparameterisa3Dpointlist(inWCS)tobeusedasthebasepointinthetargetdatabase.

:VLR-beginWblockId 3 Firstparameteristhetargetdatabaseobject(VLA-object).Secondparameteristhesourcedatabaseobject(VLA-object)containingtheobjectsbeingwblocked.ThirdparameteristheobjectIDoftheBlockTableRecordbeingwblocked.

:VLR-beginWblock:VLR-otherWblock

2 Firstparameteristhetargetdatabaseobject(VLA-object).Secondparameteris

Page 753: less than or equalAutoLISP Functions

thesourcedatabaseobject(VLA-object)containingtheobjectsbeingwblocked.

:VLR-abortWblock:VLR-endWblock

1 Thetargetdatabaseobject(VLA-object).

:VLR-beginWblockObjects 2 Firstparameteristhesourcedatabaseobject(VLA-object)containingtheobjectsbeingwblocked.SecondparameterisanIDmap.

Pleasesendusyourcommentaboutthispage

Page 754: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-window-reactor

ConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtomovingorsizinganAutoCADwindow

(vlr-window-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“Windowreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“Windowreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

Windowreactorevents

Page 755: less than or equalAutoLISP Functions

Eventname Description

:vlr-docFrameMovedOrResized AnMDIchildframewindow(adocumentwindow)hasbeenmovedorresized.

:vlr-mainFrameMovedOrResized ThemainAutoCADwindowhasbeenmovedorresized.

Windowreactorcallbackdata

Name Listlength Parameters

:vlr-docFrameMovedOrResized:vlr-mainFrameMovedOrResized

2 ThefirstparameterisanintegercontainingtheHWNDofthewindow.Thesecondparameterindicateswhetherthewindowhasbeenmovedorresized.ThevalueisTifthewindowhasbeenmoved,nilifthewindowhasbeenresized.

Page 756: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 757: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vlr-xref-reactor

ConstructsaneditorreactorobjectthatnotifiesofaneventrelatedtoattachingormodifyingXREFs

(vlr-xref-reactordatacallbacks)

Arguments

data

AnyAutoLISPdatatobeassociatedwiththereactorobject;otherwisenilifnodata.

callbacks

Alistofpairsofthefollowingform:(event-name.callback_function)whereevent-nameisoneofthesymbolslistedinthe“XREFreactorevents”tablebelow,andcallback_functionisasymbolrepresentingafunctiontobecalledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:reactor_object TheVLRobjectthatcalledthecallbackfunction.list Alistofextradataelementsassociatedwiththeparticularevent.Thecontentsofthislistforparticulareventsareshowninthe“XREFreactorcallbackdata”table.

ReturnValues

Thereactor_objectargument.

XREFreactorevents

Eventname Description

Page 758: less than or equalAutoLISP Functions

:VLR-beginAttach Anxrefisabouttobeattached.

:VLR-otherAttach Anexternalreferenceisbeingaddedtothedrawingdatabase.Thiseventoccursafterobjectsarecloned,butbeforeanytranslation.ThiscallbackfunctionissentjustafterbeginDeepCloneXlationnotification,butoccursonlyforthexrefattachprocess.

:VLR-abortAttach Anxrefattachoperationwasterminatedbeforesuccessfulcompletion.

:VLR-endAttach Anxrefattachoperationcompletedsuccessfully.

:VLR-redirected AnobjectIDinthexrefdrawingisbeingmodifiedtopointtotheassociatedobjectinthedrawingbeingreferenced.

:VLR-comandeered TheobjectIDoftheobjectisbeingappendedtothesymboltableofthedrawingbeingxrefedinto.

:VLR-beginRestore Anexistingxrefisabouttoberesolved(typicallywhenadrawingwith

Page 759: less than or equalAutoLISP Functions

xrefsisloading).

:VLR-abortRestore Anxrefunloadorreloadwasterminatedbeforesuccessfulcompletion.

:VLR-endRestore Anexistingxrefhasbeenresolved(typicallywhenadrawingwithxrefshascompletedloading).

:VLR-xrefSubcommandBindItem TheBINDsubcommandofXREFwasinvoked,orapreexistingxrefisbeingbound.NotethattheBINDsubcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandAttachItem TheATTACHsubcommandofXREFwasinvoked,orapreexistingxrefisbeingresolved.NotethattheATTACHsubcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandOverlayItem TheOVERLAYsubcommandofXREFwasinvoked,orapreexistingxrefisbeingresolved.NotethattheOVERLAY

Page 760: less than or equalAutoLISP Functions

subcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandDetachItem TheDETACHsubcommandofXREFwasinvoked.NotethattheDETACHsubcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandPathItem ThePATHsubcommandofXREFwasinvoked.NotethatthePATHsubcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandReloadItem TheRELOADsubcommandofXREFwasinvoked,orapreexistingxrefisbeingreloaded.NotethattheRELOADsubcommandisinteractiveandtriggersmultipleevents.

:VLR-xrefSubcommandUnloadItem TheUNLOADsubcommandofXREFwasinvoked,orapreexistingxrefisbeingunloaded.

Page 761: less than or equalAutoLISP Functions

XREFreactorcallbackdata

Name Listlength Parameters

:VLR-beginAttach 3 FirstparameterisaVLA-objectpointingtothetargetdrawingdatabase.Secondparameterisastringcontainingthefilenameofthexrefbeingattached.ThirdparameterisaVLA-objectpointingtothedrawingdatabasethatcontainstheobjectsbeingattached.

:VLR-otherAttach 2 FirstparameterisaVLA-objectpointingtothetargetdrawingdatabase.SecondparameterisaVLA-objectpointingtothedrawingdatabasethatcontainsthe

Page 762: less than or equalAutoLISP Functions

objectsbeingattached.

:VLR-abortAttach 1 AVLA-objectpointingtothedrawingdatabasethatcontainstheobjectsbeingattached.

:VLR-endAttach 1 AVLA-objectpointingtothetargetdrawingdatabase.

:VLR-redirected 2 FirstparameterisanintegercontainingtheobjectIDfortheredirectedsymboltablerecord(STR)inthedrawingbeingreferenced.SecondparameterisanintegercontainingtheobjectIDfortheobjectinthexrefdrawing.

:VLR-comandeered 3 FirstparameterisaVLA-objectpointingtothedatabasereceivingthexref.Secondparameterisaninteger

Page 763: less than or equalAutoLISP Functions

containingtheobjectIDoftheobjectbeingcommandeered.ThirdparameterisaVLA-objectpointingtothedrawingdatabasethatcontainstheobjectsbeingattached.

:VLR-beginRestore 3 FirstparameterisaVLA-objectpointingtothedatabasereceivingthexref.Secondparameterisastringcontainingthexrefblocktablerecord(BTR)name.ThirdparameterisaVLA-objectpointingtothedrawingdatabasethatcontainstheobjectsbeingattached.

:VLR-abortRestore:VLR-endRestore

1 AVLA-objectpointingtothetargetdrawingdatabase.

Page 764: less than or equalAutoLISP Functions

:VLR-xrefSubcommandBindItem 2 FirstparameterisanintegerindicatingtheactivitytheBINDiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BINDoperationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.7—SentforanXDepblockboundbyXBind.

Page 765: less than or equalAutoLISP Functions

8—Sentforallothersymbols:Layers,Linetypes,TextStyles,andDimStyles.SecondparameterisanintegercontainingtheobjectIDofthexrefbeingbound,or0ifnotapplicable.

:VLR-xrefSubcommandAttachItem 2 FirstparameterisanintegerindicatingtheactivitytheATTACHiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BIND

Page 766: less than or equalAutoLISP Functions

operationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.Secondparameterisastringidentifyingthefilebeingattached;otherwisenilifnotapplicable.

:VLR-xrefSubcommandOverlayItem 2 FirstparameterisanintegerindicatingtheactivitytheOVERLAYiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfully

Page 767: less than or equalAutoLISP Functions

bound.4—BINDsubcommandcompleted.5—BINDoperationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.Secondparameterisastringidentifyingthefilebeingoverlaid;otherwisenilifnotapplicable.

:VLR-xrefSubcommandDetachItem 2 FirstparameterisanintegerindicatingtheactivitytheDETACHiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththe

Page 768: less than or equalAutoLISP Functions

indicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BINDoperationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.SecondparameterisanintegercontainingtheobjectIDofthexrefbeingdetached,or0ifnotapplicable.

:VLR-xrefSubcommandPathItem 3 FirstparameterisanintegerindicatingtheactivitytheDETACHis

Page 769: less than or equalAutoLISP Functions

carryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BINDoperationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.SecondparameterisanintegercontainingtheobjectIDofthexrefbeingoperatedon,or0ifnotapplicable.

Page 770: less than or equalAutoLISP Functions

Thirdparameterisastringidentifyingthenewpathnameofthexref;otherwisenilifnotapplicable.

:VLR-xrefSubcommandReloadItem 2 FirstparameterisanintegerindicatingtheactivitytheRELOADiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BINDoperationisabouttoeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhas

Page 771: less than or equalAutoLISP Functions

eitherterminatedorfailedtocompleteonthespecifiedobjectID.SecondparameterisanintegercontainingtheobjectIDofthexrefbeingreloaded,or0ifnotapplicable.

:VLR-xrefSubcommandUnloadItem 2 FirstparameterisanintegerindicatingtheactivitytheUNLOADiscarryingout.Possiblevaluesare0—BINDsubcommandinvoked.2—xrefwiththeindicatedobjectIDisbeingbound.3—xrefwiththeindicatedobjectIDwassuccessfullybound.4—BINDsubcommandcompleted.5—BINDoperationisabout

Page 772: less than or equalAutoLISP Functions

toeitherterminateorfailtocompleteonthespecifiedobjectID.6—BINDoperationhaseitherterminatedorfailedtocompleteonthespecifiedobjectID.SecondparameterisanintegercontainingtheobjectIDofthexrefbeingunloaded,or0ifnotapplicable.

Pleasesendusyourcommentaboutthispage

Page 773: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>VFunctions>

vports

Returnsalistofviewportdescriptorsforthecurrentviewportconfiguration

(vports)

ReturnValues

Oneormoreviewportdescriptorlistsconsistingoftheviewportidentificationnumberandthecoordinatesoftheviewport'slower-leftandupper-rightcorners.

IftheAutoCADTILEMODEsystemvariableissetto1(on),thereturnedlistdescribestheviewportconfigurationcreatedwiththeAutoCADVPORTScommand.Thecornersoftheviewportsareexpressedinvaluesbetween0.0and1.0,with(0.0,0.0)representingthelower-leftcornerofthedisplayscreen'sgraphicsarea,and(1.0,1.0)theupper-rightcorner.IfTILEMODEis0(off),thereturnedlistdescribestheviewportobjectscreatedwiththeMVIEWcommand.Theviewportobjectcornersareexpressedinpaperspacecoordinates.Viewportnumber1isalwayspaperspacewhenTILEMODEisoff.

Examples

Givenasingle-viewportconfigurationwithTILEMODEon,thevportsfunctionmightreturnthefollowing:

((1(0.00.0)(1.01.0)))

Givenfourequal-sizedviewportslocatedinthefourcornersofthescreenwhenTILEMODEison,thevportsfunctionmightreturnthefollowinglists:

((5(0.50.0)(1.00.5))

(2(0.50.5)(1.01.0))

(3(0.00.5)(0.51.0))

(4(0.00.0)(0.50.5)))

Thecurrentviewport'sdescriptorisalwaysfirstinthelist.Intheprevious

Page 774: less than or equalAutoLISP Functions

example,viewportnumber5isthecurrentviewport.

Pleasesendusyourcommentaboutthispage

Page 775: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

WFunctions

wcmatchPerformsawild-cardpatternmatchonastringwhileEvaluatesatestexpression,andifitisnotnil,evaluatesotherexpressions;repeatsthisprocessuntilthetestexpressionevaluatestonilwrite-charWritesonecharactertothescreenortoanopenfilewrite-lineWritesastringtothescreenortoanopenfile

Pleasesendusyourcommentaboutthispage

Page 776: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>WFunctions>

wcmatch

Performsawild-cardpatternmatchonastring

(wcmatchstringpattern)

Arguments

string

Astringtobecompared.Thecomparisoniscase-sensitive,souppercaseandlowercasecharactersmustmatch.

pattern

Astringcontainingthepatterntomatchagainststring.Thepatterncancontainthewild-cardpattern-matchingcharactersshowninthetableWild-cardcharacters.Youcanusecommasinapatterntoentermorethanonepatterncondition.Onlythefirst500characters(approximately)ofthestringandpatternarecompared;anythingbeyondthatisignored.

Bothargumentscanbeeitheraquotedstringorastringvariable.ItisvalidtousevariablesandvaluesreturnedfromAutoLISPfunctionsforstringandpatternvalues.

ReturnValues

Ifstringandpatternmatch,wcmatchreturnsT;otherwise,wcmatchreturnsnil.

Wild-cardcharacters

Character Definition

Page 777: less than or equalAutoLISP Functions

# (pound) Matchesanysinglenumericdigit.

@ (at) Matchesanysinglealphabeticcharacter.

. (period) Matchesanysinglenonalphanumericcharacter.

* (asterisk) Matchesanycharactersequence,includinganemptyone,anditcanbeusedanywhereinthesearchpattern:atthebeginning,middle,orend.

? (questionmark) Matchesanysinglecharacter.

~ (tilde) Ifitisthefirstcharacterinthepattern,itmatchesanythingexceptthepattern.

[...] Matchesanyoneofthecharactersenclosed.

[~...] Matchesanysinglecharacternotenclosed.

- (hyphen) Usedinsidebracketstospecifyarangeforasinglecharacter.

, (comma) Separatestwopatterns.

` (reversequote) Escapesspecialcharacters(readsnextcharacterliterally).

Examples

ThefollowingcommandtestsastringtoseeifitbeginswiththecharacterN:Command:(wcmatch"Name""N*")

T

Thefollowingexampleperformsthreecomparisons.Ifanyofthethreepatternconditionsismet,wcmatchreturnsT.Thetestsare:

Doesthestringcontainthreecharacters?

Page 778: less than or equalAutoLISP Functions

Doesthestringnotcontainanm?

Doesthestringbeginwiththeletter“N”?

Ifanyofthethreepatternconditionsismet,wcmatchreturnsT:Command:(wcmatch"Name""???,~*m*,N*")

T

Inthisexample,thelastconditionwasmet,sowcmatchreturnedT.

UsingEscapeCharacterswithwcmatch

Totestforawild-cardcharacterinastring,youcanusethesinglereverse-quotecharacter(`)toescapethecharacter.Escapemeansthatthecharacterfollowingthesinglereversequoteisnotreadasawild-cardcharacter;itiscomparedatitsfacevalue.Forexample,tosearchforacommaanywhereinthestring“Name”,enterthefollowing:

Command:(wcmatch"Name""*`,*")

nil

BoththeCandAutoLISPprogramminglanguagesusethebackslash(\)asanescapecharacter,soyouneedtwobackslashes(\\)toproduceonebackslashinastring.Totestforabackslashcharacteranywherein“Name”,usethefollowingfunctioncall:

Command:(wcmatch"Name""*`\\*")

nil

Allcharactersenclosedinbrackets([...])arereadliterally,sothereisnoneedtoescapethem,withthefollowingexceptions:thetildecharacter(~)isreadliterallyonlywhenitisnotthefirstbracketedcharacter(asin"[A~BC]");otherwise,itisreadasthenegationcharacter,meaningthatwcmatchshouldmatchallcharactersexceptthosefollowingthetilde(asin"[~ABC]").Thedashcharacter(-)isreadliterallyonlywhenitisthefirstorlastbracketedcharacter(asin"[-ABC]"or"[ABC-]")orwhenitfollowsaleadingtilde(asin"[~-ABC]").Otherwise,thedashcharacter(-)isusedwithinbracketstospecifyarangeofvaluesforaspecificcharacter.Therangeworksonlyforsinglecharacters,so"STR[1-38]"matchesSTR1,STR2,STR3,andSTR8,and"[A-Z]"matchesanysingleuppercaseletter.

Theclosingbracketcharacter(])isalsoreadliterallyifitisthefirstbracketedcharacterorifitfollowsaleadingtilde(asin"[]ABC]"or"[~]ABC]").

Page 779: less than or equalAutoLISP Functions

Note Becauseadditionalwild-cardcharactersmightbeaddedinfuturereleasesofAutoLISP,itisagoodideatoescapeallnonalphanumericcharactersinyourpatterntoensureupwardcompatibility.

Pleasesendusyourcommentaboutthispage

Page 780: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>WFunctions>

while

Evaluatesatestexpression,andifitisnotnil,evaluatesotherexpressions;repeatsthisprocessuntilthetestexpressionevaluatestonil

(whiletestexpr[expr...])

Thewhilefunctioncontinuesuntiltestexprisnil.

Arguments

testexpr

Theexpressioncontainingthetestcondition.

expr

Oneormoreexpressionstobeevaluateduntiltestexprisnil.

ReturnValues

Themostrecentvalueofthelastexpr.

Examples

Thefollowingcodecallsuserfunctionsome-functentimes,withtestsetto1through10.Itthenreturns11,whichisthevalueofthelastexpressionevaluated:

(setqtest1)

(while(<=test10)

(some-functest)

(setqtest(1+test))

)

Pleasesendusyourcommentaboutthispage

Page 781: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>WFunctions>

write-char

Writesonecharactertothescreenortoanopenfile

(write-charnum[file-desc])

Arguments

num

ThedecimalASCIIcodeforthecharactertobewritten.

file-desc

Afiledescriptorforanopenfile.

ReturnValues

Thenumargument.

Examples

ThefollowingcommandwritestheletterCtothecommandwindow,andreturnsthesuppliednumargument:

Command:(write-char67)

C67

Assumingthatfisthedescriptorforanopenfile,thefollowingcommandwritestheletterCtothatfile:

Command:(write-char67f)

67

Notethatwrite-charcannotwriteaNULLcharacter(ASCIIcode0)toafile.

Pleasesendusyourcommentaboutthispage

Page 782: less than or equalAutoLISP Functions
Page 783: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>WFunctions>

write-line

Writesastringtothescreenortoanopenfile

(write-linestring[file-desc])

Arguments

string

Astring.

file-desc

Afiledescriptorforanopenfile.

ReturnValues

Thestring,quotedinthenormalmanner.Thequotesareomittedwhenwritingtoafile.

Examples

Openanewfile:Command:(setqf(open"c:\\mydocuments\\new.tst""w"))

#<file"c:\\mydocuments\\new.tst">

Usewrite-linetowritealinetothefile:Command:(write-line"Toboldlygowherenomadhasgonebefore."f)

"Toboldlygowherenomadhasgonebefore."

Thelineisnotphysicallywrittenuntilyouclosethefile:Command:(closef)

nil

Page 784: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 785: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

XFunctions

xdroomReturnstheamountofextendeddata(xdata)spacethatisavailableforanobject(entity)xdsizeReturnsthesize(inbytes)thatalistoccupieswhenitislinkedtoanobject(entity)asextendeddata

Pleasesendusyourcommentaboutthispage

Page 786: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>XFunctions>

xdroom

Returnstheamountofextendeddata(xdata)spacethatisavailableforanobject(entity)

(xdroomename)

Becausethereisalimit(currently,16kilobytes)ontheamountofextendeddatathatcanbeassignedtoanentitydefinition,andbecausemultipleapplicationscanappendextendeddatatothesameentity,thisfunctionisprovidedsoanapplicationcanverifythereisroomfortheextendeddatathatitwillappend.Itcanbecalledinconjunctionwithxdsize,whichreturnsthesizeofanextendeddatalist.

Arguments

ename

Anentityname(enamedatatype).

ReturnValues

Anintegerreflectingthenumberofbytesofavailablespace.Ifunsuccessful,xdroomreturnsnil.

Examples

Thefollowingexamplelooksuptheavailablespaceforextendeddataofaviewportobject:

Command:(xdroomvpname)

16162

Inthisexample,16,162bytesoftheoriginal16,383bytesofextendeddataspaceareavailable,meaningthat221bytesareused.

Page 787: less than or equalAutoLISP Functions

Pleasesendusyourcommentaboutthispage

Page 788: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>XFunctions>

xdsize

Returnsthesize(inbytes)thatalistoccupieswhenitislinkedtoanobject(entity)asextendeddata

(xdsizelst)

Arguments

lst

Avalidlistofextendeddatathatcontainsanapplicationnamepreviouslyregisteredwiththeuseoftheregappfunction.SeetheExamplessectionofthisfunctionforlstexamples.

ReturnValues

Anintegerreflectingthesize,inbytes.Ifunsuccessful,xdsizereturnsnil.

Bracefields(groupcode1002)mustbebalanced.AninvalidlstgeneratesanerrorandplacestheappropriateerrorcodeintheERRNOvariable.Iftheextendeddatacontainsanunregisteredapplicationname,youseethiserrormessage(assumingthatCMDECHOison):

Invalidapplicationnamein1001group

Examples

Thelstcanstartwitha-3groupcode(theextendeddatasentinel),butitisnotrequired.Becauseextendeddatacancontaininformationfrommultipleapplications,thelistmusthaveasetofenclosingparentheses.

(-3("MYAPP"(1000."SUITOFARMOR")

(1002."{")

(1040.0.0)

(1040.1.0)

(1002."}")

Page 789: less than or equalAutoLISP Functions

)

)

Hereisthesameexamplewithoutthe-3groupcode.Thislistisjustthecdrofthefirstexample,butitisimportantthattheenclosingparenthesesareincluded:

(("MYAPP"(1000."SUITOFARMOR")

(1002."{")

(1040.0.0)

(1040.1.0)

(1002."}")

)

)

Pleasesendusyourcommentaboutthispage

Page 790: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>

ZFunctions

zeropVerifiesthatanumberevaluatestozero

Pleasesendusyourcommentaboutthispage

Page 791: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>AutoLISPFunctions>ZFunctions>

zerop

Verifiesthatanumberevaluatestozero

(zeropnumber)

Arguments

number

Anumber.

ReturnValues

Tifnumberevaluatestozero;otherwisenil.

ExamplesCommand:(zerop0)

T

Command:(zerop0.0)

T

Command:(zerop0.0001)

nil

Pleasesendusyourcommentaboutthispage

Page 792: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>

ExternallyDefinedCommands

AutoCAD®commandsdefinedbyObjectARX®orAutoLISP®applicationsarecalledexternallydefined.AutoLISPapplicationsmayneedtoaccessexternallydefinedcommandsdifferentlyfromthewaytheyaccessbuilt-inAutoLISPfunctions.ManyexternallydefinedcommandshavetheirownprogramminginterfacesthatallowAutoLISPapplicationstotakeadvantageoftheirfunctionality.

Foradditionalinformationonthecommandsdescribedinthisappendix,seetheCommandReference.

aligncalmirror3drotate3dsolprof

Pleasesendusyourcommentaboutthispage

Page 793: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>ExternallyDefinedCommands>

alignTranslatesandrotatesobjects,allowingthemtobealignedwithotherobjects(externallydefined:geom3dObjectARXapplication)

(alignarg1arg2

...)

Arguments

arg1arg2...

ArgumentstotheAutoCADALIGNcommand.Theorder,number,andtypeofargumentsforthealignfunctionarethesameasifyouwereenteringALIGNatthecommandline.Toindicateanullresponse(auserpressingENTER),specifyniloranemptystring("").

ReturnValues

Tifsuccessful;otherwisenil.

Examples

Thefollowingexamplespecifiestwopairsofsourceanddestinationpoints,whichperforma2Dmove:

(setqss(ssget))

(alignsss1d1s2d2"""2d")

Pleasesendusyourcommentaboutthispage

Page 794: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>ExternallyDefinedCommands>

calInvokestheon-linegeometrycalculatorandreturnsthevalueoftheevaluatedexpression(externallydefined:geomcalObjectARXapplication)

(c:calexpression)

Arguments

expression

Aquotedstring.SeeCALintheCommandReferenceforadescriptionofallowableexpressions.

ReturnValues

Theresultoftheexpression.

Examples

ThefollowingexampleusescalinanAutoLISPexpressionwiththetransfunction:

(trans(c:cal"[1,2,3]+MID")12)

Pleasesendusyourcommentaboutthispage

Page 795: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>ExternallyDefinedCommands>

mirror3dReflectsselectedobjectsaboutauser-specifiedplane(externallydefined:geom3dObjectARXapplication)

(mirror3darg1arg2

...)

Arguments

Theorder,number,andtypeofargumentsforthemirror3dfunctionarethesameasifyouwereenteringtheMIRROR3DAutoCADcommand.TosignifyauserpressingENTERwithouttypinganyvalues,useniloranemptystring("").

ReturnValues

Tifsuccessfu;,otherwisenil.

Examples

ThefollowingexamplemirrorstheselectedobjectsabouttheXYplanethatpassesthroughthepoint0,0,5,andthendeletestheoldobjects:

(setqss(ssget))

(mirror3dss"XY"'(005)"Y")

Pleasesendusyourcommentaboutthispage

Page 796: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>ExternallyDefinedCommands>

rotate3dRotatesanobjectaboutanarbitrary3Daxis(externallydefined:geom3dObjectARXapplication)

(rotate3dargs...)

Arguments

args

Theorder,number,andtypeofargumentsfortherotate3dfunctionarethesameasifyouwereenteringthematthecommandline;seeROTATE3DintheCommandReference.Tosignifyanullresponse(userpressingENTERwithoutspecifyinganyarguments),useniloranemptystring("").

ReturnValues

Ifsuccessful,rotate3dreturnsT;otherwiseitreturnsnil.

Examples

Thefollowingexamplerotatestheselectedobjects30degreesabouttheaxisspecifiedbypointsp1andp2.

(setqss(ssget))

(rotate3dssp1p230)

AutoLISPsupportfortherotate3dfunctionisimplementedwiththeuseoftheSAGETlibrary.

Pleasesendusyourcommentaboutthispage

Page 797: less than or equalAutoLISP Functions

AutoLISPReferenceGuide>ExternallyDefinedCommands>

solprofCreatesprofileimagesofthree-dimensionalsolids(externallydefined:solidsObjectARXapplication

(c:solprofargs...)

Arguments

args

Theorder,number,andtypeofargumentsarethesameasthosespecifiedwhenissuingSOLPROFattheCommandprompt.

Pleasesendusyourcommentaboutthispage