+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
  1. #1
    Senior Member gS7's Avatar
    Computer Details
    gS7's Computer Details
    Operating System:
    Windows Xp sp3
    RAM:
    4 GB
    Monitor:
    Viewsonic
    Discipline
    Surveying
    gS7's Discipline Details
    Occupation
    Drafts man / Surveyor
    Discipline
    Surveying
    Using
    AutoCAD 2009
    Join Date
    May 2012
    Location
    Hyderabad , India
    Posts
    166

    Default Need Little Help To Fix My Lisp File

    Registered forum members do not see this ad.

    Dear ...
    big bros
    I need Little Help to Fix My Lisp file ...
    i am Trying to create Chainage Lisp file and i succeed to Put "_POINT" to Polyline with given Interval
    But here i have one Problem how to insert Tick Mark Means PERPENDICULAR LINE to Every Point ....i tried lots of time ...but its fails ......please help to learn how to insert lines ....Explain me bit wise please
    i used render man Sub function i dnt know where i want to use this
    Code:
    (defun _GetPerpAng (startPoint endPoint add)
      (+ (* (if add 0.50 -0.50) pi) (angle startPoint endPoint))
    )
    My Code :
    Code:
    ;;Chainge Distance 
    
    (defun *error* (msg)
      (if (not
    	(member msg '("Function cancelled" "quit / exit abort"))
          )
        (princ (strcat "\nError: " msg))
      )
      (setvar "CMDECHO" old_cmh)
      (setvar "osmode" old_osm)
      (setvar "clayer" old_lay)
      (princ)
    )
    
    (defun c:Chainage()
      (vl-load-com)
      (setq old_cmh(getvar "cmdecho"))
      (setq old_osm(getvar "osmode"))
      (setq old_lay(getvar "clayer"))
      (setvar "cmdecho" 0)
      (setvar "osmode" 0)
      (if (setq ss(car(entsel "\nPick Polyline >>")))
        (progn
    	   (setq interval(getreal "\nEnter Chainage Interval:"))
    	   (setq Nxt_dist interval)
    	   (setq pl_len(vlax-curve-getdistatparam ss(vlax-curve-getendparam ss)))
    	   (setq spt(vlax-curve-getstartpoint ss))
    	   (setq ept(vlax-curve-getendpoint ss))
    	   (command "_POINT" spt)(command "_POINT" ept)
    	   (repeat
    	      (fix(/ pl_len interval))
    		  (setq M_point(vlax-curve-getpointatdist ss interval))
    		  (command "_POINT" M_point)
    		  (setq interval(+ nxt_dist interval))
    	   )
    	)
      (princ "\nNo Polyline Selected:")
      )
      (setvar "cmdecho" old_cmd)
      (setvar "osmode" old_osm)
      (setvar "clayer" old_lay)
      (princ)
     )

    waiting for your answers .......


    Find my attachment


    CHAINAGE.dwg
    Last edited by gS7; 20th Oct 2012 at 03:54 pm.

  2. #2
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Are you wanting to put a tick instead of a point on the interval? or both?
    Why not use DIVIDE/MEASURE command and use block for intervals? or am i missing something?

  3. #3
    Senior Member gS7's Avatar
    Computer Details
    gS7's Computer Details
    Operating System:
    Windows Xp sp3
    RAM:
    4 GB
    Monitor:
    Viewsonic
    Discipline
    Surveying
    gS7's Discipline Details
    Occupation
    Drafts man / Surveyor
    Discipline
    Surveying
    Using
    AutoCAD 2009
    Join Date
    May 2012
    Location
    Hyderabad , India
    Posts
    166

    Default

    Dear pBe i dont want to use Pint For Example i used that object ...but my requirement is i want to insert Line tick mark and also i need to put distance text to each points .........

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Pardon for my ignorance. what will the final drawing look like? Chainage is all greek to me.
    -A picture is worth a thousand words-

    EDIT: oops... i did not see your post there gs7

    A chainage line (the Pline) is always straight? Then a block with attributes is the way to go in this case.
    Except the first and last point that is.

    Hang on... guess you can use your lisp then.... but i'm more inclined to use an attribute block

  5. #5
    Senior Member gS7's Avatar
    Computer Details
    gS7's Computer Details
    Operating System:
    Windows Xp sp3
    RAM:
    4 GB
    Monitor:
    Viewsonic
    Discipline
    Surveying
    gS7's Discipline Details
    Occupation
    Drafts man / Surveyor
    Discipline
    Surveying
    Using
    AutoCAD 2009
    Join Date
    May 2012
    Location
    Hyderabad , India
    Posts
    166

    Default My attachment

    My attachment
    CHAINAGE.dwg

  6. #6
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Hang in there, i will help you fix your lisp, we will still use your original approach so you may understand it better.

  7. #7
    Senior Member gS7's Avatar
    Computer Details
    gS7's Computer Details
    Operating System:
    Windows Xp sp3
    RAM:
    4 GB
    Monitor:
    Viewsonic
    Discipline
    Surveying
    gS7's Discipline Details
    Occupation
    Drafts man / Surveyor
    Discipline
    Surveying
    Using
    AutoCAD 2009
    Join Date
    May 2012
    Location
    Hyderabad , India
    Posts
    166

    Default

    oh! tank u pbe ...i will wait for reply

  8. #8
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Code:
    (defun c:Chainage (/ *error*   _GetPerpAng	   ss	     interval
    		     Nxt_dist  pl_len	 scale_	   points    spt
    		     ept       mpoint	 M_point   cur
    		    )
    (defun *error* (msg)
    (command "._undo" "_end")  
      (if (not
    	(member msg '("Function cancelled" "quit / exit abort"))
          )
        (princ  msg)
      )
      (setvar "CMDECHO" old_cmh)
      (setvar "osmode" old_osm)
      (setvar "clayer" old_lay)
      (setvar "attreq" old_atq)
      (princ)
    )  
    (defun _GetPerpAng (startPoint endPoint add)
      (+ (* (if add 0.50 -0.50) pi) (angle startPoint endPoint))
    )
    (defun rtd (a)
    (/ (* a 180.0) pi)
    )  
      (vl-load-com)
      (setq old_cmh (getvar "cmdecho"))
      (setq old_osm (getvar "osmode"))
      (setq old_lay (getvar "clayer"))
      (setq old_atq (getvar "attreq"))
      (setvar "cmdecho" 0)
      (command "._undo" "_begin")
      (setvar "osmode" 0)
      (setvar "attreq" 1)
      
      (if (and (setq ss (car(entsel "\nPick Polyline >>")))
    	   (setq interval (getdist "\nEnter Chainage Interval: "))
          	   (setq scale_ (getreal "\nEnter Block Scale: "))
    	   )
        (progn
               (setq points (mapcar 'cdr (vl-remove-if-not '(lambda (j)
                                   ( = (car j) 10)) (setq ent (entget ss)))))
    	   (setq Nxt_dist interval)
    	   (setq pl_len	  (vlax-curve-getdistatparam ss
    			    (vlax-curve-getendparam ss)
    			  )
    		 Interval (- Interval)
    		 spt	  (car points)
    		 ept	  (cadr points)
    	   )
    	   (repeat (+ (fix (/ pl_len (abs interval))) 2)
    	   (setq interval (+ nxt_dist interval)
    		 interval (if (> interval pl_len) pl_len interval))  
               (setq M_point (vlax-curve-getpointatdist ss interval))
    	   (if (> (vlax-curve-getDistAtPoint ss M_point)(vlax-curve-getDistAtPoint ss ept))
    		  (setq	points (cdr points)
    			spt    (car points)
    			ept    (cadr points)))   				
    	   (command "_insert" "label" M_point scale_ 
    			(rtd (_GETPERPANG spt ept nil))
    		     (setq cur (strcat "Ch:" (rtos interval 2 0) "m")))
    	   (print cur)  
    	   )
    C      )
      (princ "\nNo Polyline Selected:")
      )
      (*error* "")
      (princ)
     )
    Insert this block om your drawing

    label.dwg

    CODE UPDATED:
    Last edited by pBe; 21st Oct 2012 at 01:38 am.

  9. #9
    Senior Member gS7's Avatar
    Computer Details
    gS7's Computer Details
    Operating System:
    Windows Xp sp3
    RAM:
    4 GB
    Monitor:
    Viewsonic
    Discipline
    Surveying
    gS7's Discipline Details
    Occupation
    Drafts man / Surveyor
    Discipline
    Surveying
    Using
    AutoCAD 2009
    Join Date
    May 2012
    Location
    Hyderabad , India
    Posts
    166

    Default

    A chainage line (the Pline) is always straight?
    dear pbe the code u posted its working perfectly when the chainage line is straight

    Sorry pBe i did not Notice what u have asked , the chainage line straight or not
    and also i have made a mistake i.e i attached straight line drawing ....
    sorry for ignorance .......

    actually i am using Road Center line as my chainage line ....... so that line is having so many curve points ........

    please find my another attachment .........

    Chainage-2.dwg

  10. #10
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Registered forum members do not see this ad.

    See updated code gS7,

    The placement of the labels ( blocks ) will depend on the direction of the polyline.

    Keep on coding

Similar Threads

  1. Help with LISP file
    By StevJ in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 16th Nov 2010, 10:31 pm
  2. lisp for getting file name
    By noyjoreb in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 19th May 2010, 05:06 pm
  3. Looking for a little help with this lisp file
    By cadk in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 7th Mar 2010, 03:10 pm
  4. run lisp on file
    By JONTHEPOPE in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 20th Apr 2009, 07:39 pm
  5. HELP! i need help on this lisp file?
    By steel man in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 2nd Oct 2007, 09:26 pm

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