Bonjour,

J'ai récupéré un lisp pour inserer des bloc a la place de point sur autocad.
Par contre j'aimerai le modifier afin de pouvoir ne l'appliquer que sur un calque donné tout en récuprant les données d'objets de ces points.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; Routine pour dessiner un Bloc sur des points graphiques
;;; Version 2 corrigee pour ne traiter que des points
;;; Commande:  P2B
;;;--------------------------------------------------------------------;
;;; PNT2BLK.LSP -  July 2001 - Original Routine 
;;; Place a block object in the location of selected point objects.
;;;--------------------------------------------------------------------;
;;; Function: PNT2BLK --> P2B
;;; function to convert point objects to blocks.
;;; block must be defined in the current drawing
;;; blocks including attdefs will not address the attributes
;;; if the block references attdefs with default or constant values, 
;;; these will be populated.
 
 
(defun c:p2b (/ ss ct len e eb bname pt attreqhold echohold)
 
;;;get command echo setting and store it
(setq echohold (getvar "CMDECHO"))
 
;;;set command echo off
(setvar "CMDECHO" 0)
 
;;;get attribute request setting and store it
(setq attreqhold (getvar "ATTREQ"))
 
;;;set attribute request off
(setvar "ATTREQ" 0)
 
;;;get name of block to insert
(setq bname (getstring "\nBlock name: "))
 
;;;check that the block is defined in the current drawing
(if (tblsearch "block" bname)
(progn
 
;;;prompt for point selection
(princ "\nSelect point objects:")
 
 
(if (setq ss (ssget '((0 . "POINT"))))
 
(progn
 
;;;walk through point objects
(setq len (sslength ss))
(setq ct 0)
(while (< ct len)
 
;;;for each point
(setq e (ssname ss ct))
(setq ct (+ ct 1))
(setq eb (entget e))
;;;get insert point
(setq pt (cdr (assoc 10 eb)))
;;;insert block
(command "_insert" bname pt "" "" "")
)
)
 
(princ "\nNo point  objects selected.")
)
)
(princ "\nInvalid, block not defined in drawing.")
)
 
;;;restore command echo setting to stored value
(setvar "CMDECHO" echohold)
 
;;;restore attribute request setting to stored value
(setvar "ATTREQ" 0)
 
(princ)
)
Est ce que quelqu'un a la solution a mon problème???

De plus j'aimerai savoir s'il existe une bibliotheque de lisp pour autocad??

Merci par avance.