Author Topic: (program) Compute proportionate distances  (Read 2950 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28725
(program) Compute proportionate distances
« on: October 04, 2004, 01:32:39 PM »
Code: [Select]

(defun c:proprt (/ p_block m_block lot)
  (princ "\nCompute proportionate distances based on Plat & Field measurments")
  (if (setq p_block (getreal "\nEnter platted block dimension: "))
    (if (setq m_block (getreal "\nEnter measured block dimension: "))
      (while (setq lot (getreal "\nEnter Lot dimension to proportion (<enter> to quit): "))
             ;; NOTE: '_pa' is global
             ;; this allows the us to use the computed distance
             ;; with native acad commands, like 'circle'
             ;; example
             ;; Command: circle
             ;; Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
             ;; Specify radius of circle or [Diameter] <49.9855>: !_pa
             ;; 49.9855
             (setq _pa (* (/ lot p_block) m_block))
             (princ (strcat "Proportionate dimension = " (rtos _pa)))
             )
      )
    )
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28725
(program) Compute proportionate distances
« Reply #1 on: October 04, 2004, 02:03:41 PM »
added some things, changed some things
Code: [Select]

;;; FUNCTION
;;; compute proportainate distances based on Plat & Field
;;; distances. Input can be either keyboard on picked points
;;;
;;; ARGUMENTS
;;; none
;;;
;;; USAGE
;;; proprt = just computes the distance
;;; proprtc = computes the distance and draws a circle from
;;;           selected point with a radius equal the computer
;;;           distance.
;;;
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2004 Mark S. Thomas
;;; mark@theswamp.org
;;;
;;; VERSION
;;; 1.2 Mon Oct 04, 2004 14:00:24
(defun c:proprt (/ p_block m_block lot)
  (princ "\nCompute proportionate distances based on Plat & Field measurments")
  (if (setq p_block (getdist "\nPlatted block dimension: "))
    (if (setq m_block (getdist "\nMeasured block dimension: "))
      (while (setq lot (getreal "\nLot dimension to proportion (<enter> to quit): "))
             ;; NOTE: '_pa' is global
             ;; this allows the us to use the computed distance
             ;; with native acad commands, like 'circle'
             ;; example
             ;; Command: circle
             ;; Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
             ;; Specify radius of circle or [Diameter] <49.9855>: !_pa
             ;; 49.9855
             (setq _pa (* (/ lot p_block) m_block))
             (princ (strcat "Proportionate dimension = " (rtos _pa)))
             )
      )
    )
  (princ)
  )

(defun c:proprtc (/ p_block m_block lot _pa)
  (princ "\nCompute proportionate distances based on Plat & Field measurments")
  (if (setq p_block (getdist "\nPlatted block dimension: "))
    (if (setq m_block (getdist "\nMeasured block dimension: "))
      (if (setq lot (getreal "\nLot dimension to proportion (<enter> to quit): "))
        (progn
          (setq _pa (* (/ lot p_block) m_block))
          (princ (strcat "Proportionate dimension = " (rtos _pa)))
          (vl-cmdf "_circle" (getpoint "\nSpecify center point for circle: ") _pa)
          )
        )
      )
    )
  (princ)
  )

TheSwamp.org  (serving the CAD community since 2003)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
(program) Compute proportionate distances
« Reply #2 on: October 04, 2004, 02:17:08 PM »
Hi Mark, I believe with the inclusion of the vl-cmdf function you've made this 2000+ centric code. :wink:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Mark

  • Custom Title
  • Seagull
  • Posts: 28725
(program) Compute proportionate distances
« Reply #3 on: October 04, 2004, 02:18:33 PM »
dang it ........ you're right MP. Thanks.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28725
(program) Compute proportionate distances
« Reply #4 on: October 04, 2004, 03:01:05 PM »
added function to create AECC points based on computed distance and changed a couple of the prompts

Code: [Select]

;;; function
;;; compute proportionate distances based on plat & field
;;; distances. input can be either keyboard on picked points
;;;
;;; arguments
;;; none
;;;
;;; usage
;;; proprt = just computes the distance (r14+)
;;; proprtc = computes the distance and draws a circle from
;;;           selected point with a radius equal the computer
;;;           distance. (2000+)
;;; proprtp = computes and inserts an aecc point along the
;;;           selected bearing.(land desktop 2, 2i, 3, 4 and 2005)
;;;
;;;
;;; platforms
;;; r14+
;;;
;;; author
;;; copyright© 2004 mark s. thomas
;;; mark@theswamp.org
;;;
;;; version
;;; 1.2 mon oct 04, 2004 14:00:24
;;; 1.3 mon oct 04, 2004 14:48:02
;;;
;;; todo:
;;; make sure user is running ldt before starting 'proprtp'
;;; write documentation
(defun mst-createcogopoint (pointcoords / aeccproject pnts newpoint)

  (vl-load-com)

  (vl-catch-all-apply
    (function
      (lambda ()
        (setq aeccproject
              (vlax-get-property
                (vla-getinterfaceobject
                  (vlax-get-acad-object) "aecc.application")
                'activeproject)
              ); setq

        (setq pnts
              (vlax-get-property
                aeccproject 'cogopoints)
              ); setq

        (setq
          count (vlax-get-property pnts 'count)
          )

        (setq
          newpoint
          (vlax-invoke-method pnts 'add
                              (vlax-3d-point pointcoords) 1)
          ); setq

        (setq
          newpointnum (vlax-get-property newpoint 'number)
          )
        ); lambda
      ); function
    ); vl-catch-all-apply

  ); defun

(defun c:proprt (/ p_block m_block lot)
  (princ "\ncompute proportionate distances based on plat & field measurments")
  (if (setq p_block (getdist "\nplatted block dimension: "))
    (if (setq m_block (getdist "\nmeasured block dimension: "))
      (while (setq lot (getreal "\nplatted lot dimension to proportion (<enter> to quit): "))
             ;; note: '_pa' is global
             ;; this allows the us to use the computed distance
             ;; with native acad commands, like 'circle'
             ;; example
             ;; command: circle
             ;; specify center point for circle or [3p/2p/ttr (tan tan radius)]:
             ;; specify radius of circle or [diameter] <49.9855>: !_pa
             ;; 49.9855
             (setq _pa (* (/ lot p_block) m_block))
             (princ (strcat "proportionate dimension = " (rtos _pa)))
             )
      )
    )
  (princ)
  )

(defun c:proprtc (/ p_block m_block lot _pa)
  (princ "\ncompute proportionate distances based on plat & field measurments")
  (if (setq p_block (getdist "\nplatted block dimension: "))
    (if (setq m_block (getdist "\nmeasured block dimension: "))
      (if (setq lot (getreal "\nplatted lot dimension to proportion (<enter> to quit): "))
        (progn
          (setq _pa (* (/ lot p_block) m_block))
          (princ (strcat "proportionate dimension = " (rtos _pa)))
          (vl-cmdf "_circle" (getpoint "\nspecify center point for circle: ") _pa)
          )
        )
      )
    )
  (princ)
  )


(defun c:proprtp (/ p_block m_block lot start_pt dir _pa)
  (princ "\ncreate an aecc point using proportionate distances")
  (princ "based on plat & field measurments")
  (if (setq p_block (getdist "\nplatted block dimension: "))
    (if (setq m_block (getdist "\nmeasured block dimension: "))
      (if (setq start_pt (getpoint "\nselect start point: "))
        (if (setq dir (angle start_pt (getpoint start_pt "\nselect point for direction: ")))
          (while (setq lot (getreal "\nplatted lot dimension to proportion (<enter> to quit): "))
                 (setq _pa (* (/ lot p_block) m_block))
                 (princ (strcat "proportionate dimension = " (rtos _pa)))
                 (mst-createcogopoint (polar start_pt dir _pa))
                 )
          )
        )
      )
    )
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)