+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Forum Newbie
    Discipline
    Civil
    Using
    AutoCAD 2017
    Join Date
    Jun 2017
    Posts
    1

    Question distance and elevation routine

    Registered forum members do not see this ad.

    Hi guys,
    Long time ago ,I have written this lisp routine,
    This routine inputs a reference points coordinates, elevation and distance values from screen. It calculates several new points elevation and distance values and writes their elevation and distance values on screen.

    Can anyone help me compiling this routine in to vba code

    (defun C()
    ;We define the reference point
    (command "osnap" "int")
    (setq prop (getpoint "Define the reference point:"))
    (setq propx (car prop))
    (setq propy (cadr prop))
    (setq n 100)
    ;We define the reference point elevation
    (setq ropkot1 (entget (setq ropkot (car (entsel "\n Define the reference point elevation:")))))
    (setq ropkot2 (cdr (assoc 1 ropkot1)))
    (setq ropkoti (atof ropkot2))
    ;We define the reference point distance
    (setq ropmes1 (entget (setq ropmes (car (entsel "\n Define the reference point distance:")))))
    (setq ropmes2 (cdr (assoc 1 ropmes1)))
    (setq ropmesi (atof ropmes2))

    ;We pick up the new point
    (repeat n
    (command "osnap" "end")
    (setq p1 (getpoint "Define new point:"))

    (setq p1x (car p1))
    (setq p1y (cadr p1))

    (command "osnap" "none")
    (command "color" "white")
    (command "line" (list p1x p1y) (list (+ p1x 1.575) (+ p1y 2.1)) "")
    (command "line" (list (+ p1x 1.575) (+ p1y 2.1)) (list (- p1x 1.575) (+ p1y 2.1)) "")
    (command "line" (list (- p1x 1.575) (+ p1y 2.1)) (list p1x p1y) "")
    (setq m1 (- p1x propx))
    (if (< m1 0) (setq mesafe (+ ropmesi (/ (abs m1) 10))) (setq mesafe (- ropmesi (/ (abs m1) 10))))

    (setq kot (+ ropkoti (/ (- p1y propy ) 10)))
    (command "text" (list (- p1x 3.0) (+ p1y 2.5)) 1.8 0 (rtos kot 2 2))
    (command "text" (list (+ p1x 0.75) (- p1y 7)) 1.8 90 (rtos (abs mesafe) 2 2))

    )

  2. #2
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,798

    Default

    Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[CODE]Your Code Here[/CODE] =
    Code:
    Your Code Here
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  3. #3
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,819

    Default

    Registered forum members do not see this ad.

    Why convert it if it works ? You can run a lisp from VBA code if thats the problem. Just find some VBA code examples you should be able to work it out.

    Code:
    Dim basepnt, pt1, pt2, pt3 As Variant
    basepnt = ThisDrawing.Utility.GetPoint(, " Pick PIT center ")
    ptxtx1 = CStr(FormatNumber(basepnt(0), 3))
    ptxty1 = CStr(FormatNumber(basepnt(1), 3))
    pt1 = ThisDrawing.Utility.GetPoint(, " Pick 1st point ")
    A man who never made mistakes never made anything

Similar Threads

  1. lisp routine to quick select by elevation
    By ktbjx in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 17th May 2016, 03:49 am
  2. Lisp routine to add surface spot elevation points
    By broncos15 in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 3rd Sep 2015, 08:13 pm
  3. lisp routine that will difference in elevation between two points.
    By sigi-19 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 2nd Apr 2014, 08:10 am
  4. Replies: 5
    Last Post: 21st Sep 2011, 07:17 pm
  5. Routine to project a Curve Wall to Elevation
    By harilalmn in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 14th Sep 2011, 04:58 am

Tags for this Thread

Bookmarks

Posting Permissions

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