Jump to content

Recommended Posts

Posted

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

  • Replies 48
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    25

  • LtRimmer

    24

Posted

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:

Posted

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:

Posted

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:

Posted

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.

Posted

How very odd. Must be some kind of 08 bug. :?

Either way, I'm glad you were smarter than me and figured it out.

Posted

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)

Posted
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. :)

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...