Jump to content

The direction of view (help)


AIberto

Recommended Posts

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

  • AIberto

    24

  • hanhphuc

    14

  • andy_lee

    2

Top Posters In This Topic

Posted Images

I use this very simple routine to draw an arrow:

by alanjt

 

(defun c:Arrow (/ a b)
 ;; Draw quick arrow
 ;; Alan J. Thompson
 (if (and (setq a (getpoint "\nSpecify first point: "))
          (setq b (getpoint a "\nSpecity next point: "))
     )
   (command "_.leader" "_non" a "_non" b "" "" "_N")
 )
 (princ)
)

Link to comment
Share on other sites

If use the arrow, the leader would not associated with the MTEXT

i don't understand why not using normal arrow by leader it's associative.

 

however you can opt settings (qleader p1 p2 str sz sty t ) t / nil switch.

If you wanna change text height manually, just standard command: textsize

 

Updated DOV.lsp v1.1 here

anything?

Link to comment
Share on other sites

If use the arrow, the leader would not associated with the MTEXT

i don't understand why not using normal arrow by leader it's associative.

 

however you can opt settings (qleader p1 p2 str sz sty t ) t / nil switch.

If you wanna change text height manually, just standard command: textsize

 

Updated DOV.lsp v1.1 here

anything?

 

Thanks Hp! It's good!

I can accept the way of the qleader . But ,I don't want input "O" to set. I need pop-up dialog when run command.

if can without attribute block...:D

Link to comment
Share on other sites

Thanks Hp! It's good!

I can accept the way of the qleader . But ,I don't want input "O" to set. I need pop-up dialog when run command.

if can without attribute block...:D

 

always pop up? just remove "run once" flag, 'if 'statement before 'while'

[color="red"](if *dov:run-once*[/color] <----remove this
   (dov:dcl)  
[color="red"]) ;_ end of if [/color] <----remove this
(while...

The animated gif at 1st post can be done using grread effect, but just a fancy visual effect.

yes, something like Lee Mac LM:grtext is cool :)

 

This's my grread idea, (hp:pointer pt color entity)

more flexible ok. i don't use vlax-curve- , but my method just use osnap "_nea" object

dov1.gif

Edited by hanhphuc
add demo animation
Link to comment
Share on other sites

always pop up? just remove "run once" flag, 'if 'statement before 'while'

[color="red"](if *dov:run-once*[/color] <----remove this
   (dov:dcl)  
[color="red"]) ;_ end of if [/color] <----remove this
(while...

The animated gif at 1st post can be done using grread effect, but just a fancy visual effect.

yes, something like Lee Mac LM:grtext is cool :)

 

your means when Insert label.. ,use grread to Real-time status display ? ?

Link to comment
Share on other sites

  • 3 weeks later...

This is a simple example of drawing arrow.

(defun c:tt ()
(setvar "CMDECHO" 0)
(setq txt (getstring "\nEnter Text: "))
(while (and (setq pt1 (getpoint "\nStart point: "))
(setq pt2 (getpoint pt1 "\nEnd point: ")))
(setq dis (distance pt1 pt2)
ang (angle pt1 pt2)
ang2 (angle pt2 pt1)
ll (/ dis 4)
dd (/ dis 10)
ptm (mapcar '(lambda(a b) (/ (+ a b) 2)) pt1 pt2))
(setq ang1 (if (< (/ (* pi 2) 3) ang (/ (* pi 5) 3)) pi 0))
(setq an (+ ang (/ pi 2) ang1))
(command "_.PLINE" pt1 (polar pt2 ang2 ll) "W" dd 0 pt2 "")
(if (/= txt "")
(command "_.TEXT" "TC" (polar ptm an ll) dd (/ (* (- an (/ pi 2)) 180) pi) txt)
)
)
(setvar "CMDECHO" 1)
(princ)
)

Link to comment
Share on other sites

This is a simple example of drawing arrow.

(defun c:tt ()
(setvar "CMDECHO" 0)
(setq txt (getstring "\nEnter Text: "))
(while (and (setq pt1 (getpoint "\nStart point: "))
(setq pt2 (getpoint pt1 "\nEnd point: ")))
(setq dis (distance pt1 pt2)
ang (angle pt1 pt2)
ang2 (angle pt2 pt1)
ll (/ dis 4)
dd (/ dis 10)
ptm (mapcar '(lambda(a b) (/ (+ a b) 2)) pt1 pt2))
(setq ang1 (if (< (/ (* pi 2) 3) ang (/ (* pi 5) 3)) pi 0))
(setq an (+ ang (/ pi 2) ang1))
(command "_.PLINE" pt1 (polar pt2 ang2 ll) "W" dd 0 pt2 "")
(if (/= txt "")
(command "_.TEXT" "TC" (polar ptm an ll) dd (/ (* (- an (/ pi 2)) 180) pi) txt)
)
)
(setvar "CMDECHO" 1)
(princ)
)

 

@andy.

A good example. Thanks for sharing .

Link to comment
Share on other sites

hi AIberto,This is just sub-functions credit to LM & mjtd's

;; Arc to Bulge  -  Lee Mac
;; c     - center
;; a1,a2 - start, end angle
;; r     - radius
;; Returns: (<vertex> <bulge> <vertex>)

(defun [color="red"]LM:Arc->Bulge[/color] ( c a1 a2 r )
   (list
       (polar c a1 r)
       (   (lambda ( a ) (/ (sin a) (cos a)))
           (/ (rem (+ pi pi (- a2 a1)) (+ pi pi)) 4.0)
       )
       (polar c a2 r)
   )
)

; courtesy mjtd's ...谁? 
(defun [color="red"]sk_mk_arc01[/color] (pt r ang1 ang2 l_lay l_col l_lt l_lts l_lw )
 (if(and pt r ang1 ang2)
   (entmakex (list '(0 . "ARC")
                   (cons 8 (if l_lay l_lay (getvar 'clayer)))
                   (if l_col (cons 62 l_col)(cons 62 256))
                   (if l_lt (cons 6 l_lt)(cons 6 "bylayer"))
                   (cons 48 (if l_lts l_lts (getvar 'celtscale)))
                   (if l_lw (cons 370 l_lw)(cons 370 0))
                   (cons 10 pt)
                   (cons 40 r)
                   (cons 50 ang1)
                   (cons 51 ang2)
                   )
                 )
   )
 )

;refer to mjtd's code #15 shared by AIberto
(defun [color="red"]dov:arc[/color] ( pt r ccw? /  l obj ap bp p1 p2 p3 ang1 ang2 bulge )
(if (and pt (not (= ccw? "")))
   (progn (setq l (* 0.5 r))
   (setq obj (vlax-ename->vla-object ([color="red"]sk_mk_arc01[/color] pt r 0 pi nil nil nil nil nil)))

(setq ap    '("StartPoint" "EndPoint")
     bp    (mapcar ''((a b) (set (eval 'a) (vlax-get obj b)))
	    '(p1 p3)
	    (if	ccw?
	      ap
	      (reverse ap)
	      ) ;_ end of if
	    ) ;_ end of mapcar
     
     p2    (vlax-curve-getPointAtDist
      obj
      (if ccw?
	(- (vla-get-arclength obj) l)
	l
	) ;_ end of if
      ) ;_ end of vlax-curve-getPointAtDist
     ang1  (angle pt p2)
     ang2  (if	ccw?
      0
      pi
      ) ;_ end of if
     
     bulge (cadr ([color="red"]LM:Arc->Bulge[/color]
	    pt
	    (if	ccw?
	      ang2
	      ang1
	      ) ;_ end of if
	    (if	ccw?
	      ang1
	      ang2
	      ) ;_ end of if
	    r
	    ) ;_ end of LM:Arc->Bulge
	  ) ;_ end of cadr
     ) ;_ end of setq
     
   (vla-delete obj)
   (entmakex (list '(0 . "LWPOLYLINE")
		   '(100 . "AcDbEntity")
		   '(100 . "AcDbPolyline")
		   (cons 90 3)
		   (cons 10 p1)
		   (cons 42
			 (if ccw?
			   bulge
			   (* -1.0 bulge)
			   ) ;_ end of if
			 ) ;_ end of cons
		   (cons 10 p2)
		   (cons 40  (/ l 3.0))
		   (cons 41 0)
		   (cons 10 p3)
		   ) ;_ end of list
	     ) ;_ end of entmakex
   ) ;_ end of progn
   ) ;_ end of if
 (princ)
 ) ;_ end of defun

The grread effect, (hp:pointer ..) download link already in post #27

 

i'll just optimize an additional draw-arc function dov:arc if attributed CW.dwg & ACW.dwg broken support path or removed.

 

i'll let you know whether need to repost new code or minor modification....

 

dov4.gif

Edited by hanhphuc
update image
Link to comment
Share on other sites

hi AIberto,This is just sub-functions credit to LM & mjtd's

 

The grread effect, (hp:pointer ..) download link already in post #27

 

i'll just optimize an additional draw-arc function dov:arc if attributed CW.dwg & ACW.dwg broken support path or removed.

 

i'll let you know whether need to repost new code or minor modification....

 

Sorry! I don't know how to do !

Link to comment
Share on other sites

Just need to clarify, the routine only inserts attrib blocks if not exist in support folder, so it normally draws ARC & Mtext as you requested.

For your convenient i upload as attachment:

 

Nice routine. hanhphuc. Thank you very much!

You seem to forget . If exist curved arrow , so No need the text "Rotation"

How to modify the distance between the arrow and Mtext .

 

sy.png

Link to comment
Share on other sites

@ Dear friend hanhphuc.

 

The arrow on the left or on the right, it doesn't matter . If exist curved arrow , so No need the text "Rotation"

Link to comment
Share on other sites

sorry.. i just tested in block insertion

btw, spot progn of last few lines, modify in blue.

(defun c:dov [color="#696969"]( / ....)
...
...
...
...
[color="black"](progn [/color](setq pt (trans pt 1 0))[/color]
 
      (dov:MTEXT

[color="blue"] (if (= arc "")
 (strcat *SYM* " Rotation\\P\\O" *VSC*)(strcat *SYM* "\\P\\O" *VSC*))[/color]
 
	  (polar pt (atan (apply '/ (cdr (reverse (getvar "ucsxdir"))))) (* txh [color="red"]6.[/color])) ;[color="red"]<--- space= text height x6[/color]
	  txh
	  ) ;_ end of dov:MTEXT[color="#696969"]
      (dov:arc pt txh arc)
      [color="black"]) ;_ end of progn [/color]
     ) ;_ end of if

   ) ;_ end of progn
   (if	(= dd 1)
     (unload_dialog dcl_id)
     ) ;_ end of if
   ) ;_ end of if
 
 (setq *dov:run-once* nil)
 (princ)[/color]
 ) ;_ end of defun

This is not pure vanilla anymore since i mixed with mjtd's code

also dov:arc's "undocumented vlax-get" (credit to Tharwat & LM) :oops:

Link to comment
Share on other sites

sorry.. i just tested in block insertion

btw, spot progn of last few lines, modify in blue.

 

This is not pure vanilla anymore since i mixed with mjtd's code

also dov:arc's "undocumented vlax-get" (credit to Tharwat & LM) :oops:

 

OK! Thanks so much! hanhphuc, :D

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