Author Topic: Cycle Dimensioning Problem  (Read 2049 times)

0 Members and 1 Guest are viewing this topic.

myloveflyer

  • Newt
  • Posts: 152
Cycle Dimensioning Problem
« on: July 12, 2010, 11:47:02 PM »
Please friends, help, How to write to achieve the figure marked effect?
(defun c:test(/ H L pt1 pt2 pt3 pt4)
(setq H (getreal "\n Hight is:"))
(setq L (getreal "\n Length is:"))
(setq pt1 (getpoint "\n Insertion point:"))
(setq pt2 (polar pt1 0.0 4000))
(setq pt3 (polar pt2 (* pi 1.50) H))
(setq pt4 (polar pt1 (* pi 1.50) H))
(command "line" pt1 pt4 "")
(command "line" pt2 pt3 "")
(command "_.copy" (entlast) "" "m" pt2)
(repeat (fix 4.0 )
(command (setq pt2 (polar pt2 0.0 L)))
)
(command "")
(command "dimlinear" pt1 pt2 "h" "@2000,2000")
(princ)
)
Never give up !

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Cycle Dimensioning Problem
« Reply #1 on: July 13, 2010, 09:58:17 AM »
Here is another program that might suite your needs .
Try it ....
Code: [Select]
(defun c:test (/ L H G pt1 pt2 pt3)
  (setq L (getint "\nSpecify Length of Line:")
G (getint "\nSpecify Gap between Lines:")
arr (getint "\nNumber of Lines:")
pt1 (getpoint "\nSpecify first point:")
pt2 (polar pt1 (+ (/ pi 2) pi) L)
pt3 (list(car pt1)(+ (cadr pt1)150))
)
  (vl-cmdf "_.line" pt1 pt2 "")
  (setq Lst (entlast))
  (vl-cmdf "_.-array" Lst "" "_r" "" arr G)
  (vl-cmdf "dimlinear" pt1 (list (+ (car pt1)G)(cadr pt1)) pt3)
  (princ)
  )

Regards

Tharwat

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Cycle Dimensioning Problem
« Reply #2 on: July 13, 2010, 06:34:05 PM »
Here is an old routine that may give you some ideas.
It uses an existing line to offset but can be modified.
Fact is I use it to array many different objects.

Code: [Select]
;;; TrussOffset.lsp
;;;
;;; Author: Copyright© 2005 Charles Alan Butler
;;; Version:  1.0 May. 23, 2004
;;; Version:  1.1 Jul. 22, 2004
;;; Purpose: offset objects user offset distance to fill selected area
;;;          Only works on X & Y directions.
;;;          Will work with any objects
;;;
;;; [Prompts]
;;; Select objects
;;; Enter or select offset distance
;;; Pick start & end point of array distance, these picks only establish
;;;  direction and total distance, not start & end points.
;;;
(defun c:trusso (/ *error* p1 p2 ss dist num tmp)
  ;;; error function & Routine Exit
(defun *error* (msg)
  (if
    (not
      (member
        msg
        '("console break" "Function cancelled" "quit / exit abort" "")
      )
    )
     (princ (strcat "\nError: " msg))
  ) ; if
  (setvar "osmode" useros)
  (setvar "CMDECHO" usercmd)
  (princ)
) ;
 ;end error function
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "orthomode" 1)

  (prompt "\nSelect objects to offset")
  (setq ss (ssget))
  (if ss
    (progn
      (if (null to_step); global var
        (setq to_step 24)
        (setq to_step (abs to_step))
      )
      (setq tmp (getdist (strcat "\nEnter or pick offset amount. <"(rtos to_step) "> ")))
      (if tmp
        (setq to_step tmp)
      )
      (setq p1 (getpoint "Pick Starting point"))
      (if p1
        (progn
          (setq p2 (getpoint p1 "Pick End point"))
          (if p2
            (progn
              (setq p1 (list (car p1)(cadr p1)) ;3d to 2d
                    p2 (list (car p2)(cadr p2))
                    dist (distance p1 p2)
                    num  (fix (1+(/ dist to_step)))
                    ang  (angle p1 p2)
              )
              (if (or (equal ang pi 0.2)
                      (equal ang (* pi 1.5) 0.2)
                  )
                (setq to_step (- to_step)); reverse the direction
              )
              (setvar "osmode" 0)
              (cond
                ((or (equal ang 0 0.2) ; Horrizontal
                     (equal ang pi 0.2)
                 )
                 (command "_.array" ss "" "R" "" num to_step)
                )
                ((or (equal ang (/ pi 2) 0.2) ; Vertical
                     (equal ang (* pi 1.5) 0.2)
                 )
                 (command "_.array" ss "" "R" num "" to_step)
                )
              ) ; end cond stmt
            ) ; end progn
          ) ; endif
        ) ; end progn
      ) ; endif
    ) ; end progn
  ) ; endif
;;;==========  Exit Sequence  ============
  (*ERROR* "")
  (princ); Exit quietly
) ; end defun
(prompt "\nOffset Object Loaded. Enter OOS to run.")
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

myloveflyer

  • Newt
  • Posts: 152
Re: Cycle Dimensioning Problem
« Reply #3 on: July 14, 2010, 12:57:46 AM »

Very grateful to my friends, I might have a problem statement, copy the object or array of objects to achieve the objective, the key is how to do a continuous mark? :cry:
Tharwat's procedures failed to achieve continuous labeling, CAB program is very good, is not a continuous mark.
Thanks !
Never give up !