Jump to content

help on cond and repeating command


Lt Dan's legs

Recommended Posts

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)
 )
)

Link to comment
Share on other sites

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Lt Dan's legs

    11

  • alanjt

    6

  • rkmcswain

    5

  • Lee Mac

    5

Top Posters In This Topic

Posted Images

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)
)

Link to comment
Share on other sites

  • 3 weeks later...

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

@ 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)))

Link to comment
Share on other sites

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. }

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...