Jump to content

cone batter


zwonko

Recommended Posts

Here's my take.

 

;; cone_batter by ymg                                                 ;
;;                                                                    ;
;; Note that ssb remains global and is the selection set of batters,  ;
;; At a selection prompt enter !ssb                                   ;
;;                                                                    ;
;; Prog requires function midpoint.                                   ;
;;                                                                    ;

(defun c:cone_batter (/ ent1 ent2  p1 p2 cum1 cum2 len1 len2 n_bat n i)
 
  (setq ent1  (car (entsel "\n Select a TOP polyline: "))
        ent2  (car (entsel "\n Select a BOTTOM polyline: "))
        n_bat (getint "\n How many batter tics: ")
            n (+ 1 n_bat)
  )  
    
  (setq len1 (/ (vlax-curve-getdistatparam ent1 (vlax-curve-getendparam ent1)) n)
        len2 (/ (vlax-curve-getdistatparam ent2 (vlax-curve-getendparam ent2)) n)
	cum1 0.0
	cum2 0.0
	   i 0
	 ssb (ssadd)
  )  

 (repeat (+ n 1)
    (setq p1 (vlax-curve-getPointAtDist ent1 cum1)
	  p2 (vlax-curve-getPointAtDist ent2 cum2)
    )	  
    (if (zerop (rem i 2))
       (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))
       (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 (midpoint p1 p2))))
    )
    (ssadd (entlast) ssb)
    (setq cum1 (+ cum1 len1)
	  cum2 (+ cum2 len2)
	     i (+ i 1)
    )
 )
)

;; Function midpoint by ymg                                           ;
;; Returns the midpoint between 2 points.                             ;

(defun midpoint (a b) (polar a (angle a b) (* (distance a b) 0.5)))

 

ymg

 

cone_batter.lsp

Edited by ymg3
Commented the code and re-uploaded
  • Like 2
Link to comment
Share on other sites

@BIGALi have use batterticks.lsp but not function... in my autocad type tbl.. and notice " enter spacing of tick" i enter and notice display "select the batter top" i klik line on object and notice "select the opposite site"...when enter only one long line appear

Link to comment
Share on other sites

6 hours ago, shahAbdul said:

@BIGALi have use batterticks.lsp but not function... in my autocad type tbl.. and notice " enter spacing of tick" i enter and notice display "select the batter top" i klik line on object and notice "select the opposite site"...when enter only one long line appear

@shahAbdul Please upload both DWG and Lsp you use.  

Link to comment
Share on other sites

The batter tick spacing is how far along the top object the tick is placed so if an arc is say 10 long a spacing of 2.5 should work.

Link to comment
Share on other sites

@BIGAL i use 2.5 for spacing but not function..notice error display ' autocard applacation: filer error'

Link to comment
Share on other sites

12 hours ago, shahAbdul said:

i use 2.5 for spacing but not function..notice error display ' autocard applacation: filer error'

@shahAbdul you need this block at your dwg image.png.0fa5345ab9a955c1f0636ee5a9e526d4.png

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