See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Autolisp challenge

  1. #1
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Autolisp challenge

    I have a challenge for anybody who is interested. I need to be able to draw a polyline without joining the individual segments. Also I need to be able to put a specific block at the end of every segment. I'm trying to automate the drawing of my lines in a P&ID with individual polylines for segments and arrows at the end of each segment.

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Shouldn't you reply to your previous thread before you start a new one HERE ?

  3. #3
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Sorry about that. My jobs going 20 different directions right now and I'm trying to keep up as much as possible.

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Never mind ,

    If you can upload a sample drawing with the block you would to insert and showing BEFORE and AFTER it would be better for understanding the trick you want .

  5. #5
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    1

    Default Re: Autolisp challenge

    Sample DWG
    Attached Files Attached Files

  6. #6
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Quote Originally Posted by jayhay35365091 View Post
    Sample DWG
    Code:
    (Defun c:PDD (/ Insert defval bl  pt1 pt2 )  
    ;; pBe 15Nov2013 ;;
    (defun Insert (pt Nme lay ro sc)
      (entmakex (list (cons 0 "INSERT") (cons 8 lay)
                      (cons 2 Nme)(cons 50 ro)
    		  (cons 41 sc)(cons 10 pt))))
    (Defun defval (v msg)
       (setq v (cond ((getreal
            (strcat "\n" msg " <" (rtos (setq v
                  (cond ( v ) ( 1.0 ))
                ) 2 2) ">: ")))
        ( v )
      )
    ))
    (if (and
          (setq bl (Cdr (assoc 2 (tblsearch "BLOCK" "ARROW_1"))))
          (setq pwd (defval pwd "Enter Pline Width"))
          (setq scl (defval scl "Enter Scale"))
          (setq pt1 (getpoint "\nPick the first Point: "))
        )
     (while (setq pt2 (getpoint pt1 "\nPick Next point:"))
          (entmakex (list (cons 0 "LWPOLYLINE")
    		  (cons 100 "AcDbEntity")
    		  (cons 100 "AcDbPolyline")
    		  (cons 90 2) (cons 43 pwd)
    		  (cons 10 pt1)(cons 10 pt2)
    	    )
           )
    	(insert pt2 bl "FlowArrows" (angle pt1 pt2) scl)
            (setq pt1 pt2)
            )
    
    )
      (princ)
    )
    HTH

  7. #7
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Works near perfect pbejse. The scale of the block only effects the "x" direction. Is there a way to change the code to make it scale uniformly?

  8. #8
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Quote Originally Posted by jayhay35365091 View Post
    Works near perfect pbejse. The scale of the block only effects the "x" direction. Is there a way to change the code to make it scale uniformly?
    Here you go..

    Code:
    (defun Insert (pt Nme lay ro sc)
      (entmakex (list (cons 0 "INSERT") (cons 8 lay)
                      (cons 2 Nme)(cons 50 ro)
    		  (cons 41 sc)(cons 42 sc)(cons 43 sc)
    (cons 10 pt))))

  9. #9
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    Thanks a ton!! This is going to save me so much time. You are a life saver.

  10. #10
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Autolisp challenge

    If you are feeling extra savy, do you know of a way to automaticlly break the intersecting vertical lines by a specified distance?

Page 1 of 3 123 LastLast

Similar Threads

  1. Autolisp Challenge 2
    By jayhay35365091 in forum AutoLISP
    Replies: 14
    Last Post: 2014-01-22, 05:43 PM
  2. challenge !!
    By mtchuff in forum Revit Architecture - Families
    Replies: 4
    Last Post: 2008-10-20, 09:25 AM
  3. Take-off Challenge
    By ford347 in forum Revit - In Practice
    Replies: 2
    Last Post: 2007-11-09, 10:30 PM
  4. Challenge @
    By xjfswit in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2004-09-15, 01:06 AM

Posting Permissions

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