Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml


Accesul la Polilinii AutoLISP

autocad



+ Font mai mare | - Font mai mic



Accesul la Polilinii AutoLISP

Poliliniile sint entitati complexe. Ele sint formate dintr-o entitate principala de tip 'POYLINE' urmata de una sau mai multe entitati de tip 'VERTEX' terminate de o entitate de tip 'SEQUEND'. Aceasta diagrama ilustreaza lantul de entitati si numele lor.

Figura 47.Relatia dintre polyline ca entitate principala si subentitati



in afara accesarii entitatilor principale nesterse din baza de date, functia entnext va accesa subentitatile unei Polilinii si atributele entitatilor Insert. Acest capitol ilustreaza acest principiu cu ajutorul unei functii care:

Cere utilizatorului sa selecteze o polilinie.

Acceseaza subentitatile unei polilinii.

Vizualizeaza un raport despre fiecare entitate pe display.

Iese atunci cind a ajuns la capatul poliliniei.

(defun c:polylist ()

(setq old_error *error*) ;save default error handler

(defun *error* (msg) ;define new error handler

(if

(/= 'Function cancelled' msg) ;no message if user cancels

(if

(= msg 'quit / exit abort') ;no message if program deliberately

(princ) ;aborts

(princ (strcat 'anError: ' msg));otherwise, print error for user

)

(princ)

)

(setq *error* old_error) ;restore default error handler

(princ) ;quiet exit

)

(setq epick (entsel 'anSelect polyline: '))

;select an entity

(if

(not epick) ;if no entity selected, exit

(exit)

)

(setq ename (car epick)) ;get entity name

(setq elist (entget ename)) ;get association list

(setq etype (cdr (assoc 0 elist))) ;store entity type

(if

(/= 'POLYLINE' etype) ;if not a Polyline, exit

(progn

(prompt 'anNot a polyline.')

(exit)

)

)

(while ;while we have an entity name

(and ;and it's not the end of the

ename ;Polyline

(/= 'SEQEND' etype)

)

(princ 'anEntity type: ') ;print the entity type

(princ etype)

(if ;if it's a Vertex entity

(= 'VERTEX' etype) ;get its group 70 flags and

(progn ;location, and print location

(setq vflags (cdr (assoc 70 elist)))

(setq pt (cdr (assoc 10 elist)))

(princ 'anLocation: ')

(princ (car pt))

(princ ' ')

(princ (car (cdr pt)))

(princ ' ')

(princ (car (cdr (cdr pt))))

(if ;check each flag and print

(= 1 (logand 1 vflags)) ;each if true

(princ 'anVertex inserted by curve-fitting.')

)

(if

(= 2 (logand 2 vflags))

(princ 'anCurve-fit tangent defined for this vertex.')

)

(if

(= 8 (logand 8 vflags))

(princ 'anSpline vertex created by spline-fitting.')

)

(if

(= 16 (logand 16 vflags))

(princ 'anSpline frame control point.')

)

(if

(= 32 (logand 32 vflags))

(princ 'an3D Polyline vertex.')

)

(if

(= 64 (logand 64 vflags))

(princ 'an3D Polyline mesh vertex.')

)

(if

(= 128 (logand 128 vflags))

(princ 'anPolyface mesh vertex.')

)

)

)

;stop screen from scrolling

(getstring 'ananPress RETURN to continue')

(setq ename (entnext ename)) ;get next entity in Polyline

(if ;if we have an entity name

ename ;get its assocation list and

(progn ;entity type

(setq elist (entget ename))

(setq etype (cdr (assoc 0 elist)))

)

)

)

(setq *error* old_error) ;restore old error handler

(prin1) ;quiet exit



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1428
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved