See the top rated post in this thread. Click here

Results 1 to 9 of 9

Thread: Automate a coil strip layout for a rectangular blank

  1. #1
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Automate a coil strip layout for a rectangular blank

    Is there a way to automate a coil strip layout for a rectangular blank???

    The input to the drawing would be the size of the rectangle.
    Attached Images Attached Images

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    Quote Originally Posted by rhall.72202
    Is there a way to automate a coil strip layout for a rectangular blank???

    The input to the drawing would be the size of the rectangle.
    Hi rhall
    Maybe there is what you need

    f.

    Code:
    (defun C:test1 (/ pnt1 pnt2 pnt3)
    (setvar "osmode" 512)
    (setq pnt1 (trans (getpoint "\nPick start point of coil strip\n") 0 1))
    (setvar "osmode" 128)
    (setq pnt2 (getpoint pnt1 "\nPick end point of coil strip\n"))
    (setvar "osmode" 0)
    (setq pnt3 (polar pnt1 (angle pnt1 pnt2)(/ (distance pnt1 pnt2) 2)))
    (command "_.pline" pnt1 "W" "0" "0" "A" "A" 70. pnt3 pnt2  "")
    (princ)
    )
    (C:test1)

  3. #3
    I could stop if I wanted to scwegner's Avatar
    Join Date
    2004-12
    Location
    Minneapolis, MN
    Posts
    449
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    If that doesn't do it for you, this thread has a few more options.

  4. #4
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    That is a good routine, however, I am looking to also add the rectangles.
    The result should be the picture I have provided.
    This would be good for making strip layouts of rectangular blanks from master coils.

  5. #5
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    Quote Originally Posted by rhall.72202
    That is a good routine, however, I am looking to also add the rectangles.
    The result should be the picture I have provided.
    This would be good for making strip layouts of rectangular blanks from master coils.
    Hi rhall

    Sorry I answer you too late
    Try this version soluted with ActiveX
    Change it by suit and spell all prompts
    Tested on A2005 only

    Thank you

    f.

    Code:
    ;; error handler
    
    (defun bul-err (msg)
      (if
        (vl-position
          msg
          '("console break"
    	"Function cancelled"
    	"quit / exit abort"
           )
        )
         (princ "Error!")
         (princ msg)
      )
      (while (> (getvar "cmdactive") 0) (command))
      (command "._undo" "_end")
      (command "._u")
      (setq *error* olderror)
      (princ)
    )
    
    ;; create safearray of points
    
    (defun safe-points (lst / pt_list points)
      (setq pt_list (apply 'append lst))
      (setq	points (vlax-safearray-fill
    		 (vlax-make-safearray
    		   vlax-vbdouble
    		   (cons 0 (1- (length pt_list)))
    		 )
    		 pt_list
    	       )
      )
      )
    (vl-load-com)
    
    (prompt "\n	***	Type DSTP to execute	*** \n")
    
    ;;	main programm	;;
    
    (defun C:dstp (/	*error*	 acsp	  adoc	   appd	    app_point
    	       blank	cnt	 cor_list bul-err  len	    mod_rect
    	       num	olderror p1	  p2	   p3	    p4
    	       pt_list	rect	 rect_list	   step	    wid
    	      )
    
      (or adoc
          (setq adoc
    	     (vla-get-activedocument
    	       (vlax-get-acad-object)
    	     )
          )
      )
      (or appd (setq appd (vla-get-application adoc)))
      (or acsp
          (setq acsp
    	     (vla-get-block
    	       (vla-get-activelayout adoc)
    	     )
          )
      )
      (command "._undo" "_end")
      (command "._undo" "_mark")
      (setq olderror *error*)
      (setq *error* bul-err)
      
      ;; calculation rectangle vertices
      
      (setq	num	 5	;(getint "\nNumber of rectangles\n")
    	len	 20.	;(getdist "\nEnter lenght of rectangle\n")
    	wid	 12.	;(getdist "\nEnter width of rectangle\n")
    	blank	 5.	;(getdist "\nEnter space lenght between rectangles\n")
    	p1	 (trans	(getpoint "\nSpecify lower right point of rectangle\n")
    			1
    			0
    		 )
    	p2	 (trans (list (car p1) (+ (cadr p1) wid)) 1 0)
    	p3	 (trans (list (- (car p2) len) (cadr p2)) 1 0)
    	p4	 (trans (list (car p3) (cadr p1)) 1 0)
    	step	 (+ len blank)
    	cor_list (list p4 p1 p2 p3)
    	cnt	 -1
      )
      (repeat num
        (setq 
    	  pt_list (mapcar
    		    (function (lambda (x)
    				(mapcar '+ x (list (* cnt step) 0.0 0.0))
    			      )
    		    )
    		    cor_list
    		  )
    	  pt_list (safe-points pt_list)
    
    	  rect	  (vla-addpolyline acsp pt_list)
    	  cnt	  (1- cnt) 
        )
        (vlax-put-property rect 'Closed :vlax-true)
        (setq rect_list (cons rect rect_list))
      )
    
      (setq mod_rect (car rect_list))
      (setq	app_point (trans (list (+ (car p1)
    				  (+ (* cnt len) (* (1+ cnt) blank))
    			       )
    			       (+ (cadr p1) (/ wid 2))
    			 )
    			 1
    			 0
    		  )
    	app_point (vlax-3d-point app_point)
      )
      (vla-appendvertex mod_rect app_point)
      (vla-setbulge mod_rect 4 0.25)
      (vla-setbulge mod_rect 3 -0.25)
    
      (mapcar 'vlax-release-object rect_list)
      (vla-zoomextents appd)
      (vla-regen adoc acactiveviewport)
      (setq	*error*	olderror
    	bul-err	nil
      )
      (command "._undo" "_end")
      (princ)
    )
    ;TesT:(C:dstp)
    Last edited by fixo; 2005-09-07 at 01:30 PM.

  6. #6
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    Thats almost it........I would like to be able to specify the size of the rectangle.

    I am using 2006 and all I get asked for is to pick the lower corner of the rectangle.

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    1

    Default Re: Automate a coil strip layout for a rectangular blank

    Quote Originally Posted by rhall.72202
    Is there a way to automate a coil strip layout for a rectangular blank???

    The input to the drawing would be the size of the rectangle.
    I hope this helps.

    Code:
    (defun C:TEST (/ DTR ANG LL LM LML LMR LR OSMD THIRDS UL UML UMR UR)
      (defun DTR (A) (* pi (/ A 180.0))) ;;; utility to convert decimal degrees to radians
      (setq	LL     (getpoint "\nSpecify Lower Left Corner: ")
    	UR     (getcorner LL "\nSpecify Upper Right Corner: ")
    	UL     (list (car LL) (cadr UR))
    	LR     (list (car UR) (cadr LL))
    	THIRDS (* (/ 1.0 3.0) (distance LL LR))
    	ANG    (angle LL LR)
    	LML    (polar LL ANG THIRDS)
    	LMR    (polar LML ANG THIRDS)
    	UML    (polar UL ANG THIRDS)
    	UMR    (polar UML ANG THIRDS)
    	LM     (polar LL (+ (DTR 90.0) ANG) (* 0.5 (distance LL UL)))
      )
      (setq OSMD (getvar "osmode"))
      (setvar "osmode" 0)
      (command "pline" LL LR UR UL "")
      (command "pline" LML UML "")
      (command "pline" LMR UMR "")
      (command "arc" LL "e" LM "a" "90.0")
      (command "arc" UL "e" LM "a" "90.0")
      (setvar "osmode" OSMD)
      (setq OSMD nil)
    )
    It has no error control. It will only place it within the WCS, similar to the rectangle command. You can only pick the lower left and the upper right to have it correctly work. If you choose to pick in a different order, it will not draw the arcs correctly.

    Each vertical line is drawn one third the distance of the lower horizontal line from each end.

    The arcs are drawn with a start, end, and angle configuration. The angle is always 90%%d.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    That is definately what I need. Thanks for your help.

  9. #9
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Automate a coil strip layout for a rectangular blank

    Quote Originally Posted by rhall.72202
    That is definately what I need. Thanks for your help.
    You're welcome. Sorry for some of the assumptions. I wasn't sure on some of your requirements. A little description of those may help in the future.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. compress a coil
    By dpopek in forum Inventor - General
    Replies: 4
    Last Post: 2014-03-25, 02:05 PM
  2. AutoCAD 2007 - blank preview and blank prints
    By gurudas.ku in forum AutoCAD Plotting
    Replies: 2
    Last Post: 2011-10-27, 10:00 AM
  3. 2012: Coil
    By wpeacock in forum Inventor - General
    Replies: 1
    Last Post: 2011-07-17, 05:16 PM
  4. Strip out layout tab when publishing
    By MXM in forum CAD Management - General
    Replies: 2
    Last Post: 2009-05-28, 07:03 PM
  5. Coil strip routine
    By robert.1.hall72202 in forum AutoLISP
    Replies: 5
    Last Post: 2006-06-09, 01:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •