Jump to content

Why won't my lines JOIN??!!


ShadyV

Recommended Posts

Hey guys I have come a long way since my last post. My lisp has become more complex. I added a .dcl and I have been stuck for days on a minor (feels major to me) problem. When running the routine there is a option box with 3 options anytime you exit the main loop. When user chooses the "add idler" option for some reason the polyline seperates into 2 segments instead of one long one. This is driving me insane..What am I missing???

 

To test you will need a dwg with many circles and 2 layers "web" & "idler". The code is intended to be user friendly for inexperienced autocad users to be able to draw a "web path"

 

I am also open to any poor practice code fixes anyone wants to suggest. For example I know (command "-layer" "SET" "WEB" "") is probably not the right way to change layer in a lisp.. Thanks in advance for any help! 

(vl-load-com)

(defun c:vtest (/ snp pt1 mid ss ent en1 pl en2 pl1 ar END un inn un1 idl no1)


;********************
;** error function **
;********************

 (defun *error* (msg)

    (and snp (setvar 'osmode snp))
    (if	(not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
      (princ (strcat "\nError: " msg))
    )
    (princ)
  )





;****************************
;**  the neverending loop  **
;****************************

(defun draw ()
 (while (<= inn 1);					sets a value to exit loop if met if inn is more then 1
 
(if (= pt1 nil)
  (progn
    (setq pt1  (getpoint "\npick exit point on idler"))
  ) ;_ progn  
)

 (IF (> PT1 nil)
  (progn
       (setq pt2  (getpoint pt1 "\npick NEXT IDLER   OR Right click for Undo or End web"))
       (if (> pt2 nil);				*************IF WE HAVE A PT 2 PICKED
        (progn;						then do all this stuff
          (command "undo" "mark");			sets the undo point 
          (setvar 'osmode 256) ;			osnap tangent
          (command "zoom" "window" pt1 pt2);		zooms to the 2 points so tangent snaps work everytime 
          (COMMAND "LINE" pt2 pt1 "");			draws the line
          (setq pl1 (entlast));				names last line to join segments later
          (command "zoom" "previous" "");		zooms back to where we were 
          (setvar 'osmode 0);				turns off osnap
          (command "_.arc" "" en1);			draws the arc
          (setq ar (entlast));				names the arc so we can join segments later
          (setq un1 en1);				NEEDED FOR UNDO
          (setq en1 (getpropertyvalue pl1 "startpoint"));	gets endpoint for next arc next time around the loop
          (command "pedit" "m" pl pl1 ar "" "y" "j" "" "");	joins all the segments!
          (setq pl (entlast));					names the polyline
          (setvar 'osmode 512);				osnap nearest
	  (setq pt1 nil)
  
        ) ;_ progn  IF NO PT2;				if user right clicks ends loop and opens selection box
          (setq inn 2) 	   ;				set to 2 to end inner loop
       ) ;_ if1



     ) ;_ progn  IF we have no PT1
  (setq inn 3) 	   ;				set to 2 to end inner loop
 ) ;_ if

 (if (= inn 3)
   (progn
     (setq no1 1) 	   ;				no pt 1 end web option
   ) ;_ progn  
     (setq no1 nil) 	   ;				no pt 1 end web option
 ) ;_ if




 
  (setq pt2 nil)


 );end loop
);end draw FUNCTION



;********************
;**  undoend box   **
;********************
(defun undoend ()
(setq dcl_id (load_dialog "undoendidler.dcl"))		;load dialog
 
  (if (not (new_dialog "undoendidler" dcl_id)			;test for dialog
 
      );not
 
    (exit)						;exit if no dialog
 
  );if
 
  (setq w (dimx_tile "im")				;get image tile width
        h (dimy_tile "im")				;get image tile height
 
);setq
 
  (start_image "im")					;start the image
  (fill_image 0 0 w h 5)				;fill it with blue
  (end_image)						;end image

  (action_tile "Add" "(setq idl 1)")			;set value  
  (action_tile "undo" "(SETQ un 1)")    		;set value
  (action_tile "end" "(setq end 2)")			;set value


 
 
    (action_tile
    "cancel"						;if cancel button pressed
    "(done_dialog) (setq userclick nil)"		;close dialog, set flag
    );action_tile
 
  (action_tile
    "accept"						;if O.K. pressed
    " (done_dialog)(setq userclick T)"			;close dialog, set flag
  );action tile
 
  (start_dialog)					;start dialog
 
  (unload_dialog dcl_id)				;unload
 
(princ)
)





;*********************************************
;*********************************************
;*********************************************
;*********************************************
;*********************************************
;*********************************************
;*********************************************
;*********************************************
;**           Start of Vdraw                **
;*********************************************



(Setq snp (getvar "osmode"));				Gets users current snap setting to reset on error or at end of draw
(setvar 'osmode 1);					Sets osnap to endpoint
(setvar 'orthomode 0);					turns off ortho 
(command "-layer" "SET" "WEB" "")
  (setq pt1 (getpoint "\npick START point"))
(setvar 'osmode 512);					osnap nearest
(setq pt2 (getpoint pt1 "\nPick A Circle"))
(setvar 'osmode 256);					osnap tangent
  (COMMAND "LINE" pt1 pt2 "")

(setq pl (entlast));                            	names initial line pl to join segments later
(setq en1 (getpropertyvalue pl "endpoint")); 		gets endpoint of line
 (setvar 'osmode 512);					osnap nearest

(setq End nil)
(setq pt1 nil)
(while (<= End 1);*******************Start Outer loop***********************************

    (draw);						runs draw function

 (setq inn nil)
 (setq END nil)
(setq un nil)
(setq idl nil)
 (undoend);						opens undoend function (the pick box)
;******************************************************
;******************************************************
;******************************************************
;******************** UNDO IF ************************* If user chooses undo option from pickbox or not
(if (= un 1)
  (progn                          ;then do this
   (setq en1 un1)    
   (command "undo" "back")
   (setq pt1 nil)      
  ) ;_ progn
  (princ "\nNothing changed.")    ;optional if not 
) ;_ end if
;******************************************************
;******************************************************
;******************************************************

;******************** Add idler *********************** If user chooses add idler option from pickbox or not
(if (= idl 1)
  (progn                          ;then do this
   (command "-layer" "SET" "idler" "")
   (setvar 'osmode 5);					osnap center/end
   (setq idl (getpoint "\nChoose where to add idler"));		choose location for idler
   (command "circle" idl "1.125")
   (command "-layer" "SET" "WEB" "")
   (setvar 'osmode 512);					osnap nearest
  ) ;_ progn
  (princ "\nNothing changed.")    ;optional if not 
) ;_ end if
;******************************************************
;******************************************************
;******************************************************


);******************************************************End Main outer loop


;end web*********************************************After user chooses end web option

 (if (= no1 1)
   (progn
    (setq pt1  (getpoint "\nCHOOSE EXIT POINT on idler"))
   ) ;_ progn  IF we have PT1
 ) ;_ if

(setvar 'osmode 1)
    (setq pt2  (getpoint pt1 "\Choose Endpoint"))
	(setvar 'osmode 256)
	(command "zoom" "window" pt1 pt2)
		
	(COMMAND "LINE" pt2 pt1 "")
		
	(setq pl1 (entlast))
	(setq pt2 (getpropertyvalue pl1 "endpoint"))
	(command "zoom" "previous" "")
		 
	(setvar 'osmode 0)
	(command "_.arc" "" en1)
	(setq ar (entlast))
		
 	(setq en1 (getpropertyvalue pl1 "startpoint"))
 	(command "pedit" "m" pl1 pl ar "" "y" "j" "" "")
	(setq pl (entlast))
		
(setvar 'osmode snp)

);endvdraw
undoendidler : dialog {				//dialog name
      label = "Vdraw" ;		//give it a label
 
       :boxed_radio_column {			//define radio column
       label = "Type" ;				//give it a label

    	: radio_button {			//define radio button
     	  key = "Add" ;				//give it a name
     	  label = "Add Idler" ;		//give it a label
     	}					//end definition 

        : radio_button {			//define radion button
     	  key = "undo" ;				//give it a name
     	  label = "Undo" ;		//give it a label
        }					//end definition
 
     	: radio_button {			//define radio button
     	  key = "end" ;				//give it a name
     	  label = "End web" ;		//give it a label
     	}					//end definition
   
 
        }					//end radio column
 
     ok_cancel ;				//predifined OK/Cancel
 
     : row {					//define row
 
     : image {					//define image tile
     key = "im" ;				//give it a name
     height = 3.0 ;				//and a height
     width = 20.0 ;				//and now a width
     }						//end image
 
     : paragraph {				//define paragraph
 
     : text_part {				//define text
     label = "Designed and Created";		//give it some text
     }						//end text
 
     : text_part {				//define more text
     label = "by V";			//some more text
     }						//end text
 
     }						//end paragraph
 
     }						//end row
					
     }						//end dialog

 

Edited by ShadyV
Link to comment
Share on other sites

Have no direct solution for your problem because I have no idea what the drawing looks like on which it is suppost to do its magic. An idler is some kind of gear google tells me so it has to do something with mechanical drawings , that much is clear. Draw a couple of circles , ok ,  I can do that but in what configuration? Like polar or something else? My point is , post a picture with a before and after situation , if possible with the points you have to pick numbered in pick order. Maybe then someone knows what to do. I have no mechanical background but I'm sure a lot of members do and will be probably able to help you. I think its something small and simple.

 

With the little testing I was able to do on a ramdom flock of circles your routine does seem to work fine apart from the add idler problem so nice job even I know didly about gears and stuff 😉

 

As far as the coding itself , everyone has his or her own style. Whatever works best for you is just fine. I like to put as much information on one line (horizontal and compressed) as possible while others like to put everything on a separate line. Its not because its better but I'm just too lazy to scroll. like

undoendidler : dialog {label="Vdraw";
  :boxed_radio_column {label="Type";:radio_button {key="Add";label="Add Idler";} 
  :radio_button {key="undo";label="Undo";} : radio_button {key="end";label="End web";}} ok_cancel; 
  :row {:image {key="im";height=3.0;width=20.0;} 
  :paragraph {:text_part {label="Designed and Created";}:text_part {label="by V";}}}}

 

You could use something like  (setvar "clayer" "WEB")  to set a layer current.

 

All 'n all , it looks like a neat routine , nice point looping and I'm curious what the end result looks like.

 

 

 

Edited by rlx
Link to comment
Share on other sites

If I am correct this is for conveyor belts.

 

My $0.05 This is a bit shorter version of DCL Cancel button could be added. Just download Multi Radio button.lsp from here at Downloads. The second again is a different version asking for input but with image option.

 

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (not but)(setq but 1))
(setq ans (substr  (ah:butts but "V"   '("Please Choose" "Vdraw" "Add Idler" "Undo" "End web")))) 

 

image.png.5ef39576fc9ba59fd13da35e4b2826f0.png

(setq ans (AH:getvalsimg "D:\\Acadtemp\\furntable" 40 (list "Enter table size" "Enter length" 5 4 "1200" "Enter width" 5 4 "900" "Table thickness" 5 4 "30" "Enter height" 5 4 "900" "Enter Leg size" 5 4 "100")))

image.png.0562fb94d4f391e03bae314d41bdf2e1.png

 

Edited by BIGAL
Link to comment
Share on other sites

Thanks BigAl for the butts idea. I like butts. I will try that out. maybe shorten things up for me a bit.

rlx I can't upload an actual pic or .dwg of any of our presses (that would probably get me into some trouble). I attached a dwg and a pic that I use for testing. The "idlers" can be added all over the place and no "web" path is ever the same. This adding an idler makes no sense to me why it ruins my polyline and makes 2 segments. Pedit after adding the idler still joins all 3. in the command line I see 2 segments added to polyline. The next time through the loop everything appears to go normal until..... 

 

Select polyline or [Multiple]: m
Select objects:   1 found
Select objects:   1 found, 2 total
Select objects:   1 found, 3 total
Select objects:
Convert Lines, Arcs and Splines to polylines [Yes/No]? <Y> y
Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Reverse/Undo]: j
Join Type = Extend
Enter fuzz distance or [Jointype] <0.00000000>:
1 segments added to polyline

 

WHY WHY WHY!!!?  Ha ha I am reading the same code and following it step by step over and over and not finding anything.

 

 

image.png

press.dwg

Link to comment
Share on other sites

I sort of know what goes wrong with your routine. My first thought when I saw your routine was the use of the entlast function but I couldn't test (prove) it because I didn't understood what the routine was suppost to do. Now that I know how it works I placed a breakpoint (the hand symbol or F9) at the last pedit in your code , (command "pedit" "m" pl1 pl ar "" "y" "j" "" "") , and inspect the variables. When routine is paused at the breakpoint , double-click variable pl1 and click on the microscope button and it will say its a line. Do the same for pl and for ar. And then you will see that pl is not a polyline but a circle. And circles wont join...

 

Link to comment
Share on other sites

I've done it... There were numerous problems with the code... I think I sorted out all...

 

(defun c:idlers ( / *error* draw undoend fn snp pea cl px ll ur ss p1 p2 pt1 pt2 en1 en2 pl1 ar inn end diag idl pll epl pl gr )

  ;********************
  ;** error function **
  ;********************

  (defun *error* ( m )
    (setq web nil idler nil)
    (if snp (setvar 'osmode snp))
    (if pea (setvar 'peditaccept pea))
    (if cl (setvar 'clayer cl))
    (if	m (prompt m))
    (princ)
  )

  ;****************************
  ;**  the neverending loop  **
  ;****************************

  (defun draw nil
    (while (<= inn 1); sets a value to exit loop if met if inn is more then 1
      (while (and (setq pt1 (getpoint "\nPick exit point on idler / Right click-ENTER for Undo or Add idler or End web : ")) (not (and (nentselp pt1) (wcmatch (cdr (assoc 0 (entget (car (nentselp pt1))))) "CIRCLE,ARC")))))
      (if pt1
        (progn
          (initget 1)
          (setq pt2 (getpoint pt1 "\nPick NEXT IDLER : "))
          (vl-cmdf "_.UNDO" "_Mark")
          (vl-cmdf "_.LINE" "_tan" pt1 "_tan" pt2 ""); draws the line
          (setq pl1 (entlast)); names last line to join segments later
          (setq en1 (trans (cdr (assoc 10 (entget pl1))) 0 1)); gets endpoint for arc
          (vl-cmdf "_.LINE" "_non" (car pll) "_non" (cadr pll) "")
          (entdel (entlast))
          (vl-cmdf "_.ARC" "" "_non" en1); draws the arc - en1 last line "endpoint"
          (setq ar (entlast)); names the arc so we can join segments later
          (setq p1 (trans (cdr (assoc 10 (entget pl1))) 0 1) p2 (trans (cdr (assoc 11 (entget pl1))) 0 1))
          (setq pll (cons p2 pll) pll (cons p1 pll))
          (while (or (not (entget (car epl))) (= (cdr (assoc 0 (entget (car epl)))) "CIRCLE"))
            (setq epl (cdr epl))
          )
          (vl-cmdf "_.PEDIT" "_M" (car epl) ar pl1 "" "_J"); joins all the segments!
          (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
          (vl-cmdf "_.UNDO" "_Mark")
          (setq epl (cons (entlast) epl)); names the polyline
        );_ progn
        (setq diag t inn 2); IF WE HAVE NO PT1 set to 2 - end inner loop and initiate dialog box
      );_ if
      (setq pt1 nil pt2 nil)
    );_end while loop
  );_end draw FUNCTION

  ;********************
  ;**  undoend box   **
  ;********************
  (defun undoend ( / dcl_id w h )
    (setq dcl_id (load_dialog "undoendidler.dcl")); load dialog
    (if (not (new_dialog "undoendidler" dcl_id)); test for dialog
      (exit); exit if no dialog
    );_ if
    (setq w (dimx_tile "im"); get image tile width
          h (dimy_tile "im"); get image tile height
    );_ setq
    (start_image "im"); start the image
    (fill_image 0 0 w h 5); fill it with blue
    (end_image); end image
    (action_tile "add" "(setq idl 1)"); set value  
    (action_tile "end" "(setq inn 2 end 2)"); set value
    (action_tile "undo" "(setq inn 3)"); set value
    (action_tile "accept" "(done_dialog)"); if O.K. pressed close dialog
    (action_tile "cancel" "(done_dialog) (setq inn 1)"); if CANCEL pressed close dialog
    (start_dialog); start dialog
    (unload_dialog dcl_id); unload
    (princ)
  )

  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;*********************************************
  ;**           Start of idlers               **
  ;*********************************************

  (if (not (findfile "undoendidler.dcl"))
    (progn
      (setq fn (open (strcat (getvar 'roamablerootprefix) "support\\undoendidler.dcl") "w"))
      (write-line "undoendidler : dialog {label=\"Vdraw\";" fn)
      (write-line "  :boxed_radio_column {label=\"Type\";:radio_button {key=\"add\";label=\"Add Idler\";}:radio_button {key=\"undo\";label=\"Undo\";}:radio_button {key=\"end\";label=\"End web\";}} ok_cancel; " fn)
      (write-line "  :row {:image {key=\"im\";height=3.0;width=20.0;}:paragraph {:text_part {label=\"Designed and Created\";}:text_part {label=\"by V\";}}}}" fn)
      (close fn)
    )
  )
  (if (not web)
    (setq web (getstring t "\nSpecify WEB layer <\"WEB\"> : "))
  )
  (if (not idler)
    (setq idler (getstring t "\nSpecify idlers layer <\"IDLER\"> : "))
  )
  (if (= web "")
    (setq web "WEB")
  )
  (if (= idler "")
    (setq idler "IDLER")
  )
  (while (not (snvalid web))
    (prompt "\nSpecified WEB layer name is invalid...")
    (setq web (getstring t "\nSpecify WEB layer name : "))
  )
  (while (not (snvalid idler))
    (prompt "\nSpecified idlers layer name is invalid...")
    (setq idler (getstring t "\nSpecify idlers layer name : "))
  )
  (setq snp (getvar 'osmode));	Gets users current snap setting to reset on error or at end of draw
  (setvar 'osmode 512);	Sets osnap to nearest
  (setq pea (getvar 'peditaccept)); Gets current accept PEDIT mode - if 1 it's assumed that PEDIT prompting "Yes" are invoked; if 0 "Yes" token must be specified in PEDIT command
  (setvar 'peditaccept 1); Sets PEDIT mode to 1
  (setq cl (getvar 'clayer))
  (setvar 'orthomode 0); turns off ortho
  (if (not (equal (getvar 'viewdir) '(0.0 0.0 1.0) 1e-8))
    (progn
      (prompt "\nType PLAN command and restart routine...")
      (exit)
    )
  )
  (vl-cmdf "_.UNDO" "_Begin")
  (setq px (/ (getvar 'viewsize) (cadr (getvar 'screensize))))
  (setq ll (mapcar '- (getvar 'viewctr) (mapcar '/ (mapcar '* (getvar 'screensize) (list px px)) (list 2.0 2.0))))
  (setq ur (mapcar '+ (getvar 'viewctr) (mapcar '/ (mapcar '* (getvar 'screensize) (list px px)) (list 2.0 2.0))))
  (if (not (setq ss (ssget "_W" ll ur (list '(0 . "CIRCLE,ARC") (cons 210 (trans '(0.0 0.0 1.0) 1 0 t))))))
    (progn
      (if (tblsearch "LAYER" idler)
        (setvar 'clayer idler)
        (vl-cmdf "_.-LAYER" "_M" idler "")
      )
      (prompt "\nCreate starting idler...")
      (vl-cmdf "_.CIRCLE" "\\" "\\")
      (if (tblsearch "LAYER" web)
        (setvar 'clayer web)
        (vl-cmdf "_.-LAYER" "_M" web "")
      )
      (vl-cmdf "_.UNDO" "_Mark")
    )
    (progn
      (if (tblsearch "LAYER" web)
        (setvar 'clayer web)
        (vl-cmdf "_.-LAYER" "_M" web "")
      )
      (initget 1)
      (setq pt1 (getpoint "\nPick START point : "))
    )
  )
  (if (not pt1)
    (setq pt1 (getpoint "\nPick START point / Right Click-ENTER - UNDO ALL : "))
  )
  (if pt1
    (progn
      (initget 1)
      (setq pt2 (getpoint pt1 "\nPick a Circle or Arc : "))
    )
    (progn
      (vl-cmdf "_.UNDO" "_Back")
      (vl-cmdf "_.UNDO" "_Back")
      (c:idlers)
      (setq end 2 inn nil)
    )
  )
  (if pt1
    (progn
      (vl-cmdf "_.LINE" "_non" pt1 "_tan" pt2 ""); draws the line
      (setq epl (cons (entlast) epl));	adds last line list for join segments later
      (setq p1 (trans (cdr (assoc 10 (entget (entlast)))) 0 1) p2 (trans (cdr (assoc 11 (entget (entlast)))) 0 1))
      (setq pll (cons p2 pll) pll (cons p1 pll))
      (setq pt1 nil pt2 nil)
      (setq end 1 inn 1)
    )
  )

  (while (<= end 1); *******************Start Outer loop*******************
    (draw); runs draw function - Inner loop
    (if diag
      (progn
        (undoend); opens undoend function (the pick box)
        (setq diag nil)
      )
    )
    ;******************** UNDO IF ************************* If user chooses undo option from pickbox
    (if (= inn 3)
      (cond
        ( (and (entlast) (= (cdr (assoc 0 (entget (entlast)))) "LINE"))
          (prompt "\nRight Click-ENTER - UNDO ALL; Any other key for normal UNDO...")
          (if (and (or (= (car (setq gr (grread nil))) 25) (and (= (car gr) 2) (= (cadr gr) 13))) (not ss))
            (progn
              (vl-cmdf "_.UNDO" "_Back")
              (vl-cmdf "_.UNDO" "_Back")
              (c:idlers)
              (setq end 2 inn nil)
            )
            (progn
              (vl-cmdf "_.UNDO" "_Back")
              (if (tblsearch "LAYER" web)
                (setvar 'clayer web)
                (vl-cmdf "_.-LAYER" "_M" web "")
              )
              (if ss
                (progn
                  (initget 1)
                  (setq pt1 (getpoint "\nPick START point : "))
                )
              )
              (if (not pt1)
                (setq pt1 (getpoint "\nPick START point / Right Click-ENTER - UNDO ALL : "))
              )
              (if pt1
                (progn
                  (initget 1)
                  (setq pt2 (getpoint pt1 "\nPick a Circle or Arc : "))
                )
                (progn
                  (vl-cmdf "_.UNDO" "_Back")
                  (vl-cmdf "_.UNDO" "_Back")
                  (c:idlers)
                  (setq end 2 inn nil)
                )
              )
              (if pt1
                (progn
                  (vl-cmdf "_.LINE" "_non" pt1 "_tan" pt2 ""); draws the line
                  (setq epl (cons (entlast) epl));	adds last line list for join segments later
                  (setq p1 (trans (cdr (assoc 10 (entget (entlast)))) 0 1) p2 (trans (cdr (assoc 11 (entget (entlast)))) 0 1))
                  (setq pll (cons p2 pll) pll (cons p1 pll))
                  (setq pt1 nil pt2 nil)
                  (setq end 1 inn 1)
                )
              )
            )
          )
        )
        ( (and (entlast) (= (cdr (assoc 0 (entget (entlast)))) "LWPOLYLINE"))
          (vl-cmdf "_.UNDO" "_Back")
          (vl-cmdf "_.UNDO" "_Back")
          (setq pll (cddr pll) inn 1)
        )
        ( (and (entlast) (= (cdr (assoc 0 (entget (entlast)))) "CIRCLE"))
          (vl-cmdf "_.UNDO" "_Back")
          (vl-cmdf "_.UNDO" "_Back")
          (setq inn 1)
        )
      );_ cond
    );_ end if
    ;******************** Add idler *********************** If user chooses add idler option from pickbox
    (if (= idl 1)
      (progn; then do this
        (vl-cmdf "_.UNDO" "_Mark")
        (setq idl (getpoint "\nChoose where to add idler : ")); choose location for idler
        (setq idl (if (osnap idl "end,cen") (osnap idl "end,cen") idl))
        (if (tblsearch "LAYER" idler)
          (setvar 'clayer idler)
          (vl-cmdf "_.-LAYER" "_M" idler "")
        )
        (vl-cmdf "_.CIRCLE" "_non" idl "\\")
        (if (tblsearch "LAYER" web)
          (setvar 'clayer web)
          (vl-cmdf "_.-LAYER" "_M" web "")
        )
        (vl-cmdf "_.UNDO" "_Mark")
        (setq idl nil inn 1)
      );_ progn
    );_ end if
  );******************************************************End Main outer loop

  ; end web*********************************************After user chooses end web option
  (if (= inn end 2)
    (progn
      (initget 1)
      (setq pt1 (getpoint "\nCHOOSE EXIT POINT on idler : "))
      (initget 1)
      (setq pt2 (getpoint pt1 "\nChoose Endpoint : "))
      (vl-cmdf "_.LINE" "_tan" pt1 "_non" pt2 "")
      (setq pl1 (entlast))
      (setq en1 (trans (cdr (assoc 10 (entget pl1))) 0 1))
      (vl-cmdf "_.LINE" "_non" (car pll) "_non" (cadr pll) "")
      (entdel (entlast))
      (vl-cmdf "_.ARC" "" "_non" en1)
      (setq ar (entlast))
      (while (or (not (entget (car epl))) (= (cdr (assoc 0 (entget (car epl)))) "CIRCLE"))
        (setq epl (cdr epl))
      )
      (vl-cmdf "_.PEDIT" "_M" (car epl) ar pl1 "" "_J")
      (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
    )
  )
  (*error* nil)
);_ end idlers
undoendidler : dialog {label="Vdraw";
  :boxed_radio_column {label="Type";:radio_button {key="add";label="Add Idler";}:radio_button {key="undo";label="Undo";}:radio_button {key="end";label="End web";}} ok_cancel; 
  :row {:image {key="im";height=3.0;width=20.0;}:paragraph {:text_part {label="Designed and Created";}:text_part {label="by V";}}}}

HTH., M.R.

Edited by marko_ribar
Link to comment
Share on other sites

Just to inform... I've finally finished with revising lastly posted code... Now you can copy+paste it into Notepad... Routine should work well in all UCS/Views without any failure (supposing that you have drawn circles in current UCS plane)...

 

Regards, M.R.

Link to comment
Share on other sites

Final touches are added to routine... I have no feedback from OP; maybe he/she sees something I missed... To me this is now finished finally...

 

Regards, M.R.

Link to comment
Share on other sites

Sorry my notifications are messed up. I am lost with all this code you did. I will need to study some more now!

 

(vl-cmdf "_.LINE" "_tan" pt1 "_tan" pt2 "")

so far I have learned that I can set the osnap within the line drawing command...This is more exciting to me then you know. I have also now googled (or bing/aske jeeves whatever you are into)  vl-cmdf. I am now wondering why anyone would ever use "command"? 

Most of your code once again makes me feel dumb. I was finally thinking I was understanding this lisp writing a bit and you just exploded my head, reminded me that I haven't even got passed chapter 1 in the book. 

 

Playing with your re-write I have noticed that the undo will allow me to undo all the way back. This is a huge upgrade I am trying to figure out where and how in the code this is possible now. I asked to know why my line stopped joining and I opened a whole can of worms. Thank you for the time spent for sure Marko. I will be busy trying to figure out what it is you are all doing in this code now.

Edited by ShadyV
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...