Scrigroup - Documente si articole

     

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


Accesul la Block Definitions AutoLISP

autocad



+ Font mai mare | - Font mai mic



Accesul la Block Definitions AutoLISP

Block Definitions sint entitati complexe. O entitate principala de tip 'BLOCK' cu un nume unic este pastrata in tabela AutoCAD Block. Aceasta entitate este urmata de una sau mai multe entitati de orice tip, terminata cu o entitate de tip 'ENDBLK'. Aceasta diagrama ilustreaza lantul de entitati si numele entitatilor.



Figura 48. Relatia dintre intrarea in tabela Block si subentitatile acestuia.

Functia entnext acceseaza subentitatile din definitiile Block. Acest capitol ilustreaza acest principiu printr-o functie care:

Cere utilizatorului sa selecteze o entitate Insert care se refera la Block Definition.

Acceseaza Block Definition in cadrul tabelei Block.

Acceseaza subentitatile din Block Definition

Tipareste lista asociata fiecarei subentitati pe display.

Iese cind ajunge la capatul entitatii Block Definition.

(defun c:blklist (/ blist bname elist ename epick etype)

;blist Association list from Block table

;bname Name of Block Definition

;elist Entity association list

;ename Entity name

;epick List returned by entsel

;etype Entity type as string

;old_error Default error handler

(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 block: '))

;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

(/= 'INSERT' etype) ;if not an Insert, exit

(progn

(prompt 'anNot a block.')

(exit)

)

)

(setq bname (cdr (assoc 2 elist))) ;get name of Block Definition

(setq blist (tblsearch 'BLOCK' bname));get its assoc list

(setq ename (cdr (assoc -2 blist))) ;get first entity in Block

(setq elist (entget ename)) ;get its assoc list

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

(while ;while we have an entity name

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

ename ;Block Definition

(/= 'ENDBLK' etype)

)

(print elist) ;print entity's assoc list

;stop screen from scrolling

(getstring 'ananPress RETURN to continue')

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

(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: 1244
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