rkmcswain Posted July 14, 2010 Share Posted July 14, 2010 How would you go about making this' date=' Alan? I'm not wanting the full code. Just the function to insert the same block you select.[/quote'] You can use entmake and not have to worry about converting radians. ;;;example (setq ang 1.5) ;;;<- angle in radians (entmake (list (cons 0 "INSERT") (cons 2 "myblock") (cons 10 (list 0.0 0.0 0.0)) (cons 50 ang) ) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 14, 2010 Share Posted July 14, 2010 How would you go about making this' date=' Alan? I'm not wanting the full code. Just the function to insert the same block you select.[/quote'] This: (defun c:Test (/ ent eLst) (if (setq ent (car (entsel "\nSelect block: "))) (if (= "INSERT" (cdr (assoc 0 (setq eLst (entget ent))))) (while (not good) (command "_.-insert" (cdr (assoc 2 eLst)) "_r" (angtos (cdr (assoc 50 eLst))) "_s" "") (princ "\nSpecify insertion point: ") (command PAUSE) ) (princ "\nInvalid object!") ) ) (princ) ) or this: (defun c:Test (/ ent eLst pt ss) (if (setq ent (car (entsel "\nSelect block: "))) (if (= "INSERT" (cdr (assoc 0 (setq eLst (entget ent))))) (while (if acet-ss-drag-move (setq pt (acet-ss-drag-move (setq ss (ssadd ent)) (trans (cdr (assoc 10 eLst)) 0 1) "\nSpecify insertion point: " T 1 ) ) (setq pt (getpoint "\nSpecify insertion point: ")) ) (vla-put-insertionpoint (vla-copy (vlax-ename->vla-object ent)) (vlax-3d-point (trans pt 1 0)) ) ) (princ "\nInvalid object!") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted August 3, 2010 Author Share Posted August 3, 2010 I'm trying to insert a block with an attribute. Which should I use? (command "_.-insert" ... or (entmake (list ... if entmake how do I get the attribute editor to prompt? Even better, which dxf # do manipulate? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 3, 2010 Share Posted August 3, 2010 With entmake you need to entmake the insert, then entmake each of the ATTRIB entities with the respective values, then entmake the SEQEND terminating entity. Quote Link to comment Share on other sites More sharing options...
alanjt Posted August 3, 2010 Share Posted August 3, 2010 I'd either create a mock attribute editor and insert the block with entmake or vla-insert OR insert the block with entmake or vla-insert (storing as a variable) and just (vl-cmdf "_.attedit" ent). Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted August 3, 2010 Author Share Posted August 3, 2010 @ lee ______ I do not follow. (setq me "LT DAN'S LEGS") (if (or (eq me "newbie")(eq me "mildy retarded")) ) lets say this is what I have so far.. (entmake (list (cons 0 "insert")(cons 2 blockname) (cons 10 ins)(cons 50 ang))) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 3, 2010 Share Posted August 3, 2010 Eg: (entmake (list (cons 0 "INSERT") (cons 66 1) (cons 2 <BlockName>) (cons 10 <Point>) ) ) (entmake (list (cons 0 "ATTRIB") (cons 10 <Point>) (cons 40 <Height>) (cons 1 <Text>) (cons 2 <Tag>) (cons 70 0) ) ) (entmake (list (cons 0 "SEQEND") ) ) { Untested BTW - not sure if some DXF codes are not needed, or you may be missing some that may be required, but its just to give the idea. } Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted August 3, 2010 Author Share Posted August 3, 2010 thank you sir! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.