Jump to content

how to insert variable into entmake list?


samifox

Recommended Posts

hi

i need to make entities in a loop,

the location needs to be updated ,

how can i insert "live" data into the quoted list?


(defun caseA (tot seg ang / i)
 (setq i 0)

 (while (<= i (- (fix (/ tot seg)) 2))
   (entmake
     '((0 . "POINT")
(5 . "275")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbPoint")
[color="red"][b](strcat "(10 . " (polar i seg ang))[/b][/color]
      )
   )
 )
)

Link to comment
Share on other sites

Hi ,

 

i = point ( x y ) with Z or without .

ang = Angle in radians .

seg = distance

 

(entmake (list '(0 . "POINT")
              '(8 . "0")
              (cons 10 (polar i ang seg))
        )
)

Link to comment
Share on other sites

Hi ,

 

i = point ( x y ) with Z or without .

ang = Angle in radians .

seg = distance

 

(entmake (list '(0 . "POINT")
              '(8 . "0")
              (cons 10 (polar i ang seg))
        )
)

 

Thanks you!

Link to comment
Share on other sites

You're welcome .

 

Don't hesitate to ask if you have any further question .

again , i want to create a sset only of the entites that has the same layer as the first picked entity,

when i try to retrvie that item in the list i get an error

 

(defun C:Test(/ ent entLay )
 (setq ent (entget(car(entsel))))
 (ssget '((0 . "LINE") (assoc 8 ent)))
 )

 

THanks

(like your new avatar Tharwat:))

Link to comment
Share on other sites

(like your new avatar Tharwat:))

 

Thank you , happy to hear :)

 

Back to your question , you need to replace the quote with list function , read about functions QUOTE and LIST .

Link to comment
Share on other sites

Thank you , happy to hear :)

 

Back to your question , you need to replace the quote with list function , read about functions QUOTE and LIST .

 

(defun C:Test(/ ent entLay )
 (setq ent (entget(car(entsel))))
 (ssget (list '(0 . "LINE") (assoc 8 ent)))
 )

 

Thankss DUD!

Link to comment
Share on other sites

  • 3 weeks later...

hi

 

now i have problem to insert list of points into entmake

 

what im trying to do is

 

ask user to select hatch

get all its vertices as vertexlist

send vertexlist to make wipeout

make wipeout using vertexlist

 

(defun C:TEST (/ ent vertex vertexList f)
 (while (not f)
   (if	(setq ent (entget (car (entsel))))
     (if (= (cdr (assoc 0 ent)) "HATCH")
(progn
  (setq f T)
  (foreach vertex ent
    (if	(= (car vertex) 10)
      (setq vertexList (cons (cdr vertex) vertexList))
    )
    (reverse vertexList)
    (makeWout vertexList)
  ) ;_progn
)
     )
   )
 )
)
(defun makeWout	(vertexList)
 (entmakex (list
      '(0 . "WIPEOUT")
      '(100 . "AcDbEntity")
      '(410 . "Model")
      '(8 . "0")
      '(100 . "AcDbWipeout")
      (mapcar '(lambda (a) (cons 14 a)) vertexList)
    )
 )
)

Link to comment
Share on other sites

thanks, so is it possible to paste a list into entmake?

 

for your general question, YES. use append

 

Like so --->(append '(1 2 3) (list 4 5 6))

 

'(1 2 3) as the literal list and (list 4 5 6) as the result of mapcar function you have on your code.

Link to comment
Share on other sites

for your general question, YES. use append

 

Like so --->(append '(1 2 3) (list 4 5 6))

 

'(1 2 3) as the literal list and (list 4 5 6) as the result of mapcar function you have on your code.

Thank you Patrick!

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