insert block

insert block

Anonymous
Not applicable
1,199 Views
14 Replies
Message 1 of 15

insert block

Anonymous
Not applicable

any one helpe me??

 i want to insert this block with different dimensions (Dynamically)

 

(defun c:vcd ()
(setq p1 (Getpoint " Second Point: "))
(setq p2 (Getpoint " Second Point: "p1))


(if

;(or

(tblsearch "BLOCK" "vcd")

;(findfile "vcd.dwg")

; )

(command "insert" "vcd" "p1" "p2")

(princ "\n ** Diffuser block not found!")

)

(princ)

)

0 Likes
Accepted solutions (1)
1,200 Views
14 Replies
Replies (14)
Message 2 of 15

cadffm
Consultant
Consultant
Type in commandline

Command: -INSERT <enter>
and follow the steps of the commandlineversion of command INSERT.

Blockname?
VCD <enter>

...
..

Your Input for command Insert "Blockname", Coordinate, Coordinate are not all information what the command want from you.

Open Textscreen to see it easier [F2]

Sebastian

0 Likes
Message 3 of 15

ВeekeeCZ
Consultant
Consultant

If you set the variables p1 and p2 like that, then usage within the command later is without quotes.

 

(command "insert" "vcd" p1 p2)

 

 

But I think in your case should be this enough. 

 

(command-s "insert" "vcd") and that is. It's all dynamic.

0 Likes
Message 4 of 15

Anonymous
Not applicable

(defun c:vcd ()
(setq p1 (Getpoint " insertion point : "))
(setq p2 (Getpoint " Secopnd point : "p1))
(setq d (distance p1 p2))
(setq yf (/ d 300))


(if
;(or

(tblsearch "BLOCK" "vcd")

;(findfile "vcd.dwg")

; )

(command "_insert" "vcd" p1 yf 1 (angle p1 p2))
)

(princ)

)

 

 

i almost done but i didn't get rotation properly

0 Likes
Message 5 of 15

ВeekeeCZ
Consultant
Consultant

Probably just wrong units.

 

(angtos (angle p1 p2) (getvar 'AUNITS) 10)

 

Don't forget to turn the OSNAPs off, you could get unpredictable results.

 

(command "_insert" "vcd" "_non" p1 "_non" yf 1 (angtos (angle p1 p2) (getvar 'AUNITS) 10))

BTW the length of your block is 360, not 300. (if I follow the idea).

0 Likes
Message 6 of 15

Anonymous
Not applicable

(angtos (angle p1 p2) (getvar 'AUNITS) 10)

 

 

pls explain this command

0 Likes
Message 7 of 15

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

(angtos (angle p1 p2) (getvar 'AUNITS) 10)

 

 

pls explain this command


See HELP

 

Its (angtos angle unit presicion).

 

The point is, that your (angle p1 p2) returns the angle in radians. And you need for (command) drawing units (= AUNITS sysvar). So this makes the conversion.

0 Likes
Message 8 of 15

Anonymous
Not applicable

also i have flip property in may block  how control this action by lisp

 

can u complete it??

0 Likes
Message 9 of 15

ВeekeeCZ
Consultant
Consultant

See HERE

0 Likes
Message 10 of 15

Anonymous
Not applicable

but i dont know how call this function

 

 

 

0 Likes
Message 11 of 15

ВeekeeCZ
Consultant
Consultant
Call it by its name!
0 Likes
Message 12 of 15

Anonymous
Not applicable

(defun c:vcd ()
(setq p1 (Getpoint " insertion point : "))
(setq p2 (Getpoint " Secopnd point : "p1))
(setq d (distance p1 p2))
(setq yf (/ d 300))

(if
;(or

(tblsearch "BLOCK" "vcd")

;(findfile "vcd.dwg")

; )

(command "_insert" "vcd" "_non" p1 "_non" yf 1 (angtos (angle p1 p2) (getvar 'AUNITS) 10))

)


(princ)

)


(defun LM:toggleflipstate ( blk )
(vl-some
'(lambda ( prp / rtn )
(if (equal '(0 1) (vlax-get prp 'allowedvalues))
(progn
(vla-put-value prp (vlax-make-variant (setq rtn (- 1 (vlax-get prp 'value))) vlax-vbinteger))
rtn
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)

0 Likes
Message 13 of 15

Anonymous
Not applicable

can u?? pls

0 Likes
Message 14 of 15

ВeekeeCZ
Consultant
Consultant
Accepted solution
(vl-load-com)
(LM:toggleflipstate (vlax-ename->vla-object (entlast)))
0 Likes
Message 15 of 15

Anonymous
Not applicable

(defun c:vcd ()
(setq p1 (Getpoint " insertion point : "))
(setq p2 (Getpoint " Secopnd point : "p1))
(setq d (distance p1 p2))
(setq yf (/ d 300))


(if
;(or

(tblsearch "BLOCK" "vcd")

;(findfile "vcd.dwg")

; )

(command "_insert" "vcd" p1 yf 1 (angle p1 p2))
)

(princ)

)

 

 

in this program i can find file only from support folder

 

how i get in a specific folder???

0 Likes