alanjt Posted November 19, 2009 Posted November 19, 2009 What prints to the screen when you use this one: (defun c:test (/ #Entlast #Ent #Obj #Length #LType #Value) (vl-load-com) (or (setq #Entlast (entlast)) (setq #Entlast T)) (vl-cmdf "_.pline") (while (not (zerop (getvar 'cmdactive))) (princ "\nSpecify next point: ") (vl-cmdf PAUSE) ) ;_ while (cond ((not (eq #Entlast (setq #Ent (entlast)))) (setq #Obj (vlax-ename->vla-object #Ent) #Length (vla-get-length #Obj) #LType (strcase (vla-get-linetype #Obj)) ) ;_ setq (cond ;; 4-2 ((eq #LType "4-2") (setq #Value (+ (* (fix (/ (- #Length 4) 6)) 6) 4))) ;; 1-5 ((eq #LType "1-5") (setq #Value (+ (* (fix (/ (- #Length 1) 6)) 6) 1))) ;; no match (T (alert "No matching Linetypes!")) ) ;_ cond (and #Value (vl-cmdf "_.lengthen" "_total" #Value (list #Ent (getvar 'lastpoint)) "") (princ (vl-princ-to-string #Ent)) (princ (strcat "\nNew Length: " (vl-princ-to-string #Value))) (vl-catch-all-apply 'vla-put-linetypegeneration (list #Obj :vlax-true)) ) ;_ and ) ) ;_ cond (princ) ) ;_ defun Quote
LtRimmer Posted November 19, 2009 Author Posted November 19, 2009 See below: Command: test _.pline Specify start point: Specify next point: Current line-width is 0.10 Specify next point or [Arc/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Command: _.lengthen Select an object or [DElta/Percent/Total/DYnamic]: _total Specify total length or [Angle] : 34 Select an object to change or [undo]: Select an object to change or [undo]: Command: New Length: 34 Command: Quote
alanjt Posted November 19, 2009 Posted November 19, 2009 Now I'm completely confused. It's showing #Ent as a valid variable when it reaches the part where it sets the ltgen. Replace the vla with the pedit line and do it again. See below: Command: test _.pline Specify start point: Specify next point: Current line-width is 0.10 Specify next point or [Arc/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Command: _.lengthen Select an object or [DElta/Percent/Total/DYnamic]: _total Specify total length or [Angle] : 34 Select an object to change or [undo]: Select an object to change or [undo]: Command: New Length: 34 Command: Quote
LtRimmer Posted November 19, 2009 Author Posted November 19, 2009 As follows: Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: Specify next point: Command: _.lengthen Select an object or [DElta/Percent/Total/DYnamic]: _total Specify total length or [Angle] : 28 Select an object to change or [undo]: Select an object to change or [undo]: Command: New Length: 28_.pedit Select polyline or [Multiple]: Select polyline or [Multiple]: _L Enter an option [Close/Join/Width/Edit vertex/Fit/Spline/Decurve/Ltype gen/Undo]: on Invalid option keyword. Enter an option [Close/Join/Width/Edit vertex/Fit/Spline/Decurve/Ltype gen/Undo]: Command: Quote
LtRimmer Posted November 24, 2009 Author Posted November 24, 2009 alanjt, I've been playing around with your code and found that I can get it to work in 2008 by using (entlast) instead of #Ent ie (vl-cmdf "_.pedit" (entlast) "_L" "on" "") As I noticed #Ent works before the lengthen command but not after it even though the object name doesn't change! lengthen was also disabling the linetype generation. Anyway I just thought you might want to comment, or file it away in case the same issue ever comes up again. There are now a couple of us testing the routine with no complaints so far. ;-) Once again many thanks for your help. Quote
alanjt Posted November 24, 2009 Posted November 24, 2009 How very odd. Must be some kind of 08 bug. Either way, I'm glad you were smarter than me and figured it out. Quote
LtRimmer Posted November 24, 2009 Author Posted November 24, 2009 It was all trial and error plus a lot of luck as I'd never heard of lisp before I started this project. So now I'm looking around for the next one that I can do on my own this time (hopefully) Quote
alanjt Posted November 24, 2009 Posted November 24, 2009 It was all trial and error plus a lot of luck as I'd never heard of lisp before I started this project. So now I'm looking around for the next one that I can do on my own this time (hopefully) Well, good job. Quote
Recommended Posts
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.