Jump to content

old lisp file works in R10 not 2010


jimpcfd

Recommended Posts

Hi can anyone help i have a lisp file which has always worked in R14 but does not work in 2010.

the purpose of the routine is to create a cap or caps in a line or arc or circle with a given width, it will prompt you to select line , arcs or circles it then will prompt for how many gaps (bridges) then for the size of the caps (bridges).

as i say it has and still does work in R14.

 

attached is the lisp file.

 

thanks

jimpcfd

P$BRIDGE.LSP

Link to comment
Share on other sites

In any case, it looks something like a program I wrote a while back:

 

(defun c:Segs ( / *error* doc ss undo )
 ;; © Lee Mac 2010
 (vl-load-com) 

 (defun *error* ( msg )
   (and undo (vla-EndUndomark doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )

 (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) *segs (cond ( *segs ) ( 10 )))

 (if
   (and
     (setq ss (ssget "_:L" '((0 . "ARC,CIRCLE,*POLYLINE,SPLINE,LINE,ELLIPSE"))))
     (progn (initget 6)
       (setq *segs (cond ((getint (strcat "\nSpecify Number of Segments <" (itoa *segs) "> : "))) ( *segs )))
     )
   )
   (
     (lambda ( j / ent inc i pts ) (setq undo (not (vla-StartUndoMark doc)))
       
       (while (setq ent (ssname ss (setq j (1+ j))))
         (
           (lambda ( inc i / pts )
             
             (repeat (1+ *segs)
               (setq pts (cons (trans (vlax-curve-getPointatDist ent (* (setq i (1+ i)) inc)) 0 ent) pts))
             )

             (if (entmake (append (list (cons 0   "LWPOLYLINE")
                                        (cons 100 "AcDbEntity")
                                        (cons 100 "AcDbPolyline")
                                        (cons 90 (length pts))
                                        (cons 38 (caddar pts))
                                        (cons 70 0))
                                  (vl-remove 'nil
                                    (mapcar '(lambda ( d ) (assoc d (entget ent))) '(6 8 39 48 210))
                                  )
                                  (mapcar (function (lambda ( a ) (cons 10 a))) pts)))
               (entdel ent)
             )
           )
           (/ (vlax-curve-getDistatParam ent (vlax-curve-getEndParam ent)) (float *segs)) -1
         )
       )
       (setq undo (vla-EndUndoMark doc))
     )
     -1
   )
 )
 (princ)
)

 

Updated for UCS/Views.

Edited by Lee Mac
Link to comment
Share on other sites

Hi can anyone help i have a lisp file which has always worked in R14 but does not work in 2010.

the purpose of the routine is to create a cap or caps in a line or arc or circle with a given width, it will prompt you to select line , arcs or circles it then will prompt for how many gaps (bridges) then for the size of the caps (bridges).

as i say it has and still does work in R14.

attached is the lisp file.

 

thanks

jimpcfd

 

Actually the routine return an error , and I guess the use of

(setq numbridge (getint (nth 26 [b][color="red"]pv$message[/color][/b])))

is the main issue , because the pv$message is not defined in the routine .

 

Regards,

Link to comment
Share on other sites

I am sorry , also one more thing.

 

It is better to standard the command while using it for all versions of Autocad .

(command "[b][color="red"]_.[/color][/b]break" pt2 pt1)

 

Good luck.

Link to comment
Share on other sites

hi tharwat313 the pv$message are being called from acaddoc file, all messages are call that way with the lisp files we have.

i will try the changing the break command to (command "_.break" pt2 pt1) and see whether that makes a difference .

 

hi Lee, the P$bridge routine was done way back in 1987 when we were running R10, the company we brought all our system from went broke many years ago,

so it's be very hard for us to update our lisp file, i have being trying to learn autolisp i have managed to write some very simply ones but this is beyond me.

 

if it's ok with you i will copy & paste your one and have a play.

 

cheers

jimpcfd

Link to comment
Share on other sites

if it's ok with you i will copy & paste your one and have a play.

 

Certainly Jim, go ahead. :)

 

I would ask however that you mark/initial any modifications to the code, as for obvious reasons, if code is posted with incorrect unmarked modifications these can reflect directly on the reputation of the original author.

 

If you have any questions about the code, just ask.

 

Lee

Link to comment
Share on other sites

many thanks lee.

 

hi tharwat313 what happening is, once i select some lines press enter then prompted for number of bridges (say 3) press enter the prompted for size of bridges (say 5mm) press enter , what happens is the bridge don't divide up they are irregular and the gap (bridge ) will be all different sizes.

hope this makes sence.

 

cheers

jimpcfd

Link to comment
Share on other sites

I have changed your file slightly, seems to be working on my machine

Just uncomment the lines to define number of bridges and width,

as you said, these values were stored in the lsit in acaddoc.lsp

And use *vl-cmdf* instead of *command* in this case

 

~'J'~

P$BRIDGE.LSP

Link to comment
Share on other sites

thanks fixo

will try that out, why does "._break" work differently form "break" ?

 

cheers

jimpcfd

 

http://www.cadforum.cz/cadforum_en/qaID.asp?tip=2425

 

Was 'segs' on the right lines at all?

Link to comment
Share on other sites

thanks fixo

will try that out, why does "._break" work differently form "break" ?

 

cheers

jimpcfd

 

That means that code will works also with english and local Acad versions

 

~'J'~

Link to comment
Share on other sites

Hi Lee

 

tried segs works well, i would need to modify it to get it to do the same as our bridge routine.

not sure i would now where to start with that one, any tips would be great.

 

cheers

jimpcfd

Link to comment
Share on other sites

Hi Lee

 

tried segs works well, i would need to modify it to get it to do the same as our bridge routine.

not sure i would now where to start with that one, any tips would be great.

 

cheers

jimpcfd

 

Haven't looked properly at the bridge routine, but will take a look momentarily.

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