Jump to content

Recommended Posts

Posted
looked at this lisp , and thought maybe its possible to modify the routine so it works on polylines also ? i have many independent entities all of them are simple polylines (staright ,-start and end ) some of them are aligned , i have to dimension each one .

thanks !

 

So did the routine that you quote work for you and you just want to automate it for many objects ?

If not , upload a sample drawing with your goal of a lisp routine .

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    13

  • rk25134

    7

  • danielk

    4

  • mariarfd

    4

Top Posters In This Topic

Posted Images

Posted

actually it didnt work for me ... thinking about something for the situation in the picture 1.jpg

Posted
actually it didnt work for me ... thinking about something for the situation in the picture [ATTACH=CONFIG]50263[/ATTACH]

You may talking about 2dpolyline object name and not LWpolyline or wven a 3dpolyline .

Upload a sample drawing to clarify the issue and get one shoot of a routine .

Posted
rk25134, I am also newbie like you.

In my observations, the member Tharwat has been quite helpful to you. I must emphasize that Tharwat is one of the most active forum guys here and he always encouraged me.

That way he will not feel encouraged to help him again. ;)

 

hi Luis i 100% agree, we should appreciate Tharwat & others gurus here scratching their head, afford to provide free guide & spend most of their valuable time writing codes just for helping members WITHOUT FEES, good job Tharwat :)

Posted

test.dwg

You may talking about 2dpolyline object name and not LWpolyline or wven a 3dpolyline .

Upload a sample drawing to clarify the issue and get one shoot of a routine .

Posted
hi Luis i 100% agree, we should appreciate Tharwat & others gurus here scratching their head, afford to provide free guide & spend most of their valuable time writing codes just for helping members WITHOUT FEES, good job Tharwat :)

 

It is very kind of you to say that hanhphuc . :)

 

DanielK

Try this routine and if you want to change the gap distance between each created dimension object and a polyline , just change the number 5.0 to the one you'd like .

 

(defun c:DoDim (/ *error* v l ss i)
 ;;     Tharwat 06. August. 2014        ;;
 (defun *error* (u)
   (if v
     (mapcar 'setvar '(CMDECHO OSMODE) v)
   )
   (if (wcmatch (strcase u) "*BREAK*,*CANCEL*,*EXIT*")
     (princ (strcat "\n ** Error : " msg " **"))
   )
 )
 (setq v (mapcar 'getvar '(CMDECHO OSMODE)))
 (princ "\n Select a single LWPOLYLINE only ...")
 (if (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 2))))
   (progn
     (mapcar 'setvar '(CMDECHO OSMODE) '(0 0))
     (repeat (setq i (sslength ss))
       (setq l (mapcar 'cdr
                       (vl-remove-if-not
                         (function (lambda (p) (eq (car p) 10)))
                         (entget (ssname ss (setq i (1- i))))
                       )
               )
       )
       (command
         "._dimaligned"
         (car l)
         (cadr l)
         (polar (car l) (+ (* pi 0.5) (angle (car l) (cadr l))) 5.)
       )
     )
   )
 )
 (*error* nil)
 (princ)
)
(vl-load-com)

Posted
It is very kind of you to say that hanhphuc . :)

 

DanielK

Try this routine and if you want to change the gap distance between each created dimension object and a polyline , just change the number 5.0 to the one you'd like .

 

(defun c:DoDim (/ *error* v l ss i)
 ;;     Tharwat 06. August. 2014        ;;
 (defun *error* (u)
   (if v
     (mapcar 'setvar '(CMDECHO OSMODE) v)
   )
   (if (wcmatch (strcase u) "*BREAK*,*CANCEL*,*EXIT*")
     (princ (strcat "\n ** Error : " msg " **"))
   )
 )
 (setq v (mapcar 'getvar '(CMDECHO OSMODE)))
 (princ "\n Select a single LWPOLYLINE only ...")
 (if (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 2))))
   (progn
     (mapcar 'setvar '(CMDECHO OSMODE) '(0 0))
     (repeat (setq i (sslength ss))
       (setq l (mapcar 'cdr
                       (vl-remove-if-not
                         (function (lambda (p) (eq (car p) 10)))
                         (entget (ssname ss (setq i (1- i))))
                       )
               )
       )
       (command
         "._dimaligned"
         (car l)
         (cadr l)
         (polar (car l) (+ (* pi 0.5) (angle (car l) (cadr l))) 5.)
       )
     )
   )
 )
 (*error* nil)
 (princ)
)
(vl-load-com)

No Words to describe how helpful you are !!! this is exactly what i was looking for .

thank you , your work is appreciated seriously:D

Posted
No Words to describe how helpful you are !!! this is exactly what i was looking for .

thank you , your work is appreciated seriously:D

 

Excellent . You are welcome anytime DanielK :)

  • 3 weeks later...
Posted

Hi Luis, Thanks for posting this wonderful LISP PDIM.

Got a Question though. I have familiarised my self with LISP very recently since i joined this forum and am looking forward to learn LISP

Can Some one Please Explain if this LISP can be modified? explaining areas which require what type of modification in the code to achieve the same. :unsure:

 

Thanks in advance.

pdim.lsp

arch length.jpg

  • 3 years later...
Posted

Hello, thank you very much for all the great information above.

I recently discovered the potential in acad with lisps, thank all the people sharing their knowledge.

I have succesfully used 2-3 .lsp 's (thank you GC gile) provided in this forum and am in desperate need to use your routine Tharwat, as I have about 300 polys to dimension, and this need will be multiplised in the future.

I tried to find info online on how to convert text to .lsp, but I didn't quite get it (might seem rediculus to you, but it's my first time, willing to try and learn though)

What I did lastnight was to rename another lisp and try to paste the test you provided above (ok, this might be stupid but I was desperate), then I converted my polylines to lwpolylines and tried the routine. The dodim command obviously returned "zero found" when I selected a single lwpolyline.

Would anybody try and explane in a simple way for total beginners how to properly install Tharwat's routine please?

thank you all inlightened people in advance,

Maria

Posted

Would anybody try and explane in a simple way for total beginners how to properly install Tharwat's routine please?

 

Hi,

 

Copy the codes to a new txt file and save it with any name you like with the file fromat of .lsp then open your AutoCAD if its not already opened then call the command APPLOAD or just AP then select the previously saved file then load then close.

 

Now to invoke the command just call the name of the command of my routine which is after c:*** DoDim' then you are there.

 

More info about loading a lisp program IN THIS LINK

 

Good luck.

Posted

Thank you so much tharwat, you are too kind to answer!

I have learned to load applications but my problem is that when I try to save txt files from either notepad or wordpad or word there seems to be no option for a format like .lsp .arx .dvb .dbx .vlx .fas ...

I also tried to rename the txt file , adding the .lsp manualy on the name, and it still was invisible in the autocad load applications dialogue. Is there a specific program I should use to edit text and save it in the .lsp format? ...maybe this should have been my question initialy...

again thank you sooo much, I wish I could repay the favor!

Posted

You need to add the file format right after the name with a dot of course when you are about to save the codes from NOTEPAD.

 

eg: Test.lsp

 

But if you use the vlide from AutoCAD so the option would be available along with the save dialog.

AutoCAD -> Tools -> AUTOLISP -> Visual LISP Editor

Posted

thank you again, I tried it again and succeded! I think the problem was that I should choose the allfiles category and include the lisp .lsp command the first time I saved the file! thank you again very much,

Maria

Posted

Do not save via Word it can save extra hidden stuff and will screw up when trying to run.

 

Like Tharwat I just open Notepad, cut and paste then save you only have to add the .lsp to the file name and it will be saved correctly you do not need to pick a file extension, by adding the .lsp it tells notepad to overwrite the normal .txt file type.

 

I would recommend Notepad++ if you want to do more programming it has lots of helpful stuff you can set that its a lisp file you are looking at and it will provide feedback about what you have typed wrong. Again open notepad++ then cut and paste.

Posted

Thank you so much, this is usefull information for me, as I am completely ignorant regarding all things programming! Really eager to learn though, if you all have a suggestion on where one could start in order to understand the commands you advanced people write, that would be great! Is there something specific one should read regarding command codification to be able to understand / write lisps?

...If you feel like it, please check the question I just posted, subject: coordinates extraction per polyline, together with hyperlink text - I would be so greatfull ! I hope some day I can help other people here like you do,

thanks a lot, Maria

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