Jump to content

How could I use an entmakex to draw lots of points ?


Recommended Posts

Posted

Hello.

 

Is it possible to use only one an entmakex to draw the following four points

without repeating the same entamex three time ?

(setq p1 (getpoint	"\n Specify a point :")
     p2 (getpoint	"\n Specify a point :")
     p3 (getpoint	"\n Specify a point :")
     p4 (getpoint	"\n Specify a point :")
     )
(entmake (list
   (cons 0 "LINE")
   (cons 10 p1)
   (cons 11 p2)
     )
 )

 

Thanks.

 

Tharwat

Posted

Are you talking about lines?

 
(setq p1 (getpoint "\n Specify a point :")
     p2 (getpoint  p1 "\n Specify a point :")
     p3 (getpoint  p2 "\n Specify a point :")
     p4 (getpoint  p3 "\n Specify a point :")
     )
(mapcar '(lambda(a b)
(entmake (list
   (cons 0 "LINE")
   (cons 10 a)
   (cons 11 b)
     )
 )
   )
   (list p1 p2 p3 p4)
   (list p2 p3 p4 p1)
   )

Posted

Yes, My question was about draughting lines.

 

Thank you so much fixo.That was great work.

 

And could that be also possible with entmake "TEXT" or "MTEXT" ?

 

Highly appreciated.

 

Tharwat

Posted

 
(defun c:test (/ p1 p2)
 (repeat 4
   (if (not p2)
     (setq p1 (getpoint "\n Specify a point :"))
     (setq p1 p2)
   )
   (setq p2 (getpoint p1 "\n Specify a point :"))
   (entmakex
     (list
       (cons 0 "LINE")
       (cons 10 p1)
       (cons 11 p2)
     )
   )
 )
 (princ)
)

 

 

____edit___

 

Sorry, did not see fixo's response. scrolled right past it

Posted

:)

 

(if (setq p (getpoint "\nFirst Point: "))
 (while (setq q (getpoint "\rPick Next Point: " p))
   (entmake
     (list
       (cons 0 "LINE")
       (cons 10 (trans p 1 0))
       (cons 11 (trans (setq p q) 1 0))
     )
   )
 )
)

 

(defun line ( p1 / p2 )
 (cond
   ( (and p1 (setq p2 (getpoint "\rPick Next Point: " p1)))
     (entmakex
       (list
         (cons 0 "LINE") (cons 10 (trans p1 1 0)) (cons 11 (trans p2 1 0))
       )
     )
     (line p2)
   )
 )
)

(line (getpoint "\nFirst Point: "))

Posted

:)

YES. Avery great works.

 

But I meant the same routine that fixo had given me in his first post , which is making points that already made in a routine

and to use only one entmake(s) to draught them all in one.

 

So one question come up during that powerful codes that made by you gentlemen. :)

 

Is it also possible to use one entmake(s) for TEXT ?

 

Many Thanks.

 

Tharwat

Posted

You can use entmake to create almost any entity - Text included.

 

You can only create ONE entity in an entmake call.

 

Perhaps you are thinking of an LWPolyline.

Posted

Thanks a lot.

 

I am thinking of text entmakex of all texts that already made in a routine. for example ;

I have X , Y , Z with values, So how could I insert them by using one entmakex only. is that possible ?

 

(setq x '10.0
     [color="red"]y '20.0
     z 30.0[/color]
     )

(setq pt (getpoint "\n Specify text location :"))
     
(entmakex (list (cons 0 "TEXT")
                 (cons 10  pt)
                 (cons 40 (getvar 'textsize))
                 (cons 1  (rtos x 2 1))
))

 

Great thanks.

 

Tharwat

Posted

Mybe with strcat function, it does not put them one on another , and "\n" also does not help in this case .

(setq x '10.0
     y '20.0
     z 30.0
     )
(setq pt (getpoint "\n Specify text location :"))
     
(entmakex (list (cons 0 "TEXT")
                 (cons 10  pt)
                 (cons 40 (getvar 'textsize))
                 (cons 1  ([color="red"][b]strcat[/b][/color] (rtos x 2 1)[b][color="#ff00ff"]"\n"[/color][/b](rtos y 2 1)[color="#ff00ff"][b]"\n"[/b][/color](rtos z 2 1)))))

Posted

It would have to be (cons 1 mtext) and I'm not completely sure but I think you'll have to do \p

Posted
It would have to be (cons 1 mtext) and I'm not completely sure but I think you'll have to do \p

 

YES .You're right.

 

But I do not want use explode command to convert them into text .

 

Here it goes.

(setq x '10.0
     y '20.0
     z '30.0
     )
(setq pt (getpoint "\n Specify text location :"))
(entmakex (list (cons 0 "MTEXT")
	(cons 100 "AcDbEntity")
                (cons 100 "AcDbMText")
                (cons 10  pt)
                (cons 40 (getvar 'textsize))
                (cons 1  (strcat (rtos x 2 1)"\n"(rtos y 2 1)"\n"(rtos z 2 1)))))

Posted

Perhaps this will serve as an example:

 

(defun c:mpt ( / MText norm pt )
 ;; © Lee Mac 2010

 (defun MText ( pt val norm )
   (entmakex
     (list
       (cons 0 "MTEXT")
       (cons 100 "AcDbEntity")
       (cons 100 "AcDbMText")
       (cons 10 pt)
       (cons 11 (getvar 'UCSXDIR))
       (cons 1  val)
       (cons 210 norm)
     )
   )
 )

 (setq norm (trans '(0. 0. 1.) 1 0 t))

 (terpri)

 (while (setq pt (getpoint "\rSpecify Point: "))
   (setq pt (trans pt 1 0))
   
   (MText pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt))
     )
     norm
   )
 )

 (princ)
)

Posted

sorry about the \p... I don't know why I thought that

Posted
Perhaps this will serve as an example:

 

Really unbelievable.

 

First. It is performing nicely .

 

Second. Today I have been thinking to do a routine that would do the same you made in the last post. I feel speechless :)

 

So you did two in one for me tonight.

 

Thank you so much.

 

Tharwat

Posted
sorry about the \p... I don't know why I thought that

 

No problem at all. I do thank you for your kind sence of helping.

 

Highly appreciated.

 

Tharwat

Posted
Really unbelievable.

 

First. It is performing nicely .

 

Second. Today I have been thinking to do a routine that would do the same you made in the last post. I feel speechless :)

 

So you did two in one for me tonight.

 

Thank you so much.

 

Tharwat

 

You're very welcome Tharwat, I'm glad you could find it useful :)

Posted

I have just realized when I checked it out with Vlide editor .And it returns as it's clear in the response of checking ...

 

; warning: local variable used as function: MTEXT

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