• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

utilizzo di subst

  • Thread starter Thread starter anfaloni
  • Start date Start date

anfaloni

Guest
Hey, guys, I'm trying to solve this bow, but I don't go out.

I have a block whose name is "hippo" and that will have all its features including the coordinates I read to be (10 . 0.0 0.0 0.0)

Tell me where I'm wrong because I don't know where to bang my head. .

(setq var (car))

select the block and the var variable acquires the block ownership string.

in fact: (entget a) I see how to follow

((-1). <nome 7f74721d360="" entità:="">) (0 . "insert") (330 . <nome 7f7472069f0="" entità:="">) (5 . "583a6") (100 . "acdbentity") (67 . 0) (410 . "model") (48 . 0.5) (100 . "acdbblockreference") (66 . 1) (2 . "1") (10 0.0 0.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (44 .

I would now like to ask two questions:

1) but why and I say why if I write: (subst (10 100.0 100.0 0.0) (10 0.0 0.0 0.0 0.0) var) gives me error and does not allow me to move the block into the new coordinate?

2) Why, knowing that the block is called pippo, do I have to pass first by entsel and difine var rather than define (setq var "pippo")?

3) why if I define (setq coord "100,100,0") using command I can't tell pippo to move in coord?
(command "_move" pippo coord")

certainly mistake and probably also conceptually, for this I ask to a more experienced eye like your where I mistake

thanks for availability!</nome></nome>
 
Code:
(setq var (entget (car)))
(entmod (setq var (subst (cons 100.0 100.0))
Code:
(setq pippo (car (entsel))
(setq pos (cdr (assoc 10)))
(setq coord (list 100.0 100.0 0.0)
(command "_move" pippo "_non" pos "_non" coord)
 
Code:
(setq var (entget (car)))
(entmod (setq var (subst (cons 100.0 100.0))
Code:
(setq pippo (car (entsel))
(setq pos (cdr (assoc 10)))
(setq coord (list 100.0 100.0 0.0)
(command "_move" pippo "_non" pos "_non" coord)
thank you so much gp! but so I have to go through the entrosel even if I know the name of the block?
 
thank you so much gp! but so I have to go through the entrosel even if I know the name of the block?
The block name for you is poplar. for the autocad database is <nome 7f74721d360="" entità:=""></nome>
3) why if I define (setq coord "100,100,0") using command I can't tell pippo to move in coord?
Because you have to say
(command "_move" pippo oldcoord newcoord)

where pippo must contain <nome 7f74721d360="" entità:=""> </nome>(without group code (1 )
oldcoord and newcoord must be in correct format (or points without group code 10 lists, or even in text format like keyboards, provided both variables subscribe the same format)

if you use command, remember that the correct syntax is (command "_move" object "" oldcoord newcoord)
the double red quote serves to show the move command that the selection of objects to be moved is finished
 
gp, just observation, as well as... let me know which I would like to copy if I have 10 equals. .

Crystal: thank you very much for the straights. .

but you can tell me why if I use the insert command
(command "_.-insert" block coord)
where block is a variable "c:\\\\\\lore.dwg" and coord a variable with coordinates.
if I launch the command then manually ask me to insert x,y,z scale and rotation riggling me to intervene manually? Is there any way I don't let them ask or bypass this hitch when I insert a block via lisp?
 
when using the command function, in general, you have to switch to the command all the exact sequence of choices, options, inputs you would give from keyboard and also in the correct order, keeping in mind that a value "" corresponds to a sending.
 
Thank you!

true, in fact if I write (command "_insert" block coord "" "")
works properly!
 
Hi, I have a similar problem, I would like to change only the value of "x" of the coordinates, and "y" and "z" leave them unchanged, can it be done with lisp?
 
It is possible, any coordinate consists of a list with at least x and y, you can extract x and y, change x, recompose the list and replace it.
 
Maybe this helps you with extraction.
this list "print" on a floor at -1000 of altitude (near current work), the projection of the vertical view of the 3d faces and 3d lines, all pure line.
as you see, I extract from faces and lines 3d only x and z, and I use only those as were x and y, because the new z is the variable "plan" common to all the new design of the projection.
(ps.. I need for comparisons of control and various names... )



(defun zprint)
(prompt "\nprint front line: "
(setvar "cmdecho" 0)
(setq selez(ssget))
(if (/= nil selez)
(progn)
(setq max (sslength selez) Contasel 0)
(while (> max contasel)
(setq en (ssname selez contasel) alist (entget en)

(if (= "3dface" (cdr(assoc 0 alist)))
(progn)

(setq and alist)
; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(setq pnta (cdr(assoc 10 ed))))
(setq pntb (cdr(assoc 11 ed))))
(setq pntc (cdr(assoc 12 ed))))
(setq pntd (cdr(assoc 13 ed))))

(setq plan -1000)

(setq pnta (list (car pnta) (caddr pnta) plan))
(setq pntb (list (car pntb) (caddr pntb) plan )
(setq pntc (car pntc) (caddr pntc) plan )
(setq pntd (list (car pntd) (caddr pntd) plan )


(if (equal pntb ) (progn) (command "_line" pntb ) ) )
(if (equal pntb pntc) (progn) (command "_line" pntb pntc") )
(if (equal pntc pntd) (progn) (command "_line" pntc pntd") )
(if (equal pntd pnta) (progn) (command "_line" pntd pnta") )

) ; close progn
)

(if (or (= "3dline" (cdr(assoc 0 alist)))) (= "line" (cdr(assoc 0 alist)))))
(progn)
(setq pnta (cdr(assoc 10 alist)) pntb (cdr(assoc 11 alist))
(setq plan -1000)
(setq pnta (list (car pnta) (caddr pnta) plan))
(setq pntb (list (car pntb) (caddr pntb) plan )
(command "_line" pntb ")
) ; end progn
) ; close if line
(setq contasel (+ 1 accountant))
), close while
) ; close progn
)
(setvar "cmdecho" 1)
(prompt "\nready")
), close defunctor
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top