Jump to content

Automatic gridline using diffrent distance...


Recommended Posts

Posted

Hi all,

 

A pleasant ang wonderful day to you out there..This is my first time to post a thread here and I'm hoping I could make friends..

 

I'm really not good in making programs. I saw a program which is related to what I wanted to know.. I added something in it then attached it here and It's really really out of shape. My motive is to create automatic gridline only by inputing the distances and separate it by comma. when you pick a point on the screen, it will automatically draws grid with diffrent distance.

 

I am very hopeful that any of you autolisp experts are willing to help me solve this program.

 

Thanks in advance,

numskull

autogrid.LSP

Posted

Try this slightly changed lisp

Hth

 

;; autogrid.lsp

;; local defuns
;; by VovKa 
(defun sumlist (lst / )
(if lst
(append (sumlist (reverse (cdr (reverse lst))))
(list (apply '+ lst))))
 )

;; by gile
(defun str->lst (txtstr delim / pos)
 (if (setq pos (vl-string-search delim txtstr))
   (cons (substr txtstr 1 pos)
     (str->lst (substr txtstr (+ (strlen delim) pos 1)) delim)
   )
   (list txtstr)
 )
)
;;;                  main part                    ;;
(defun c:gd (/ a data dist_list e osm pt1 pt2 pt_next)
 (setq osm (getvar "osmode"))
 (setq data  (getstring "Enter grid lengths on X:"))
 (setq dist_list (str->lst data ","))
 (setq dist_list (mapcar 'atof dist_list))
 (setq dist_list (sumlist dist_list))
 (setq pt1 (getpoint "\nInsertion Point: "))
 (setq a (getangle pt1 "\nSpecify direction: "))
 (setvar "OSMODE" 0)
 (setq pt2 (polar pt1 (+ a (/ pi 2)) 1000.))
 (prompt "\nOffseting line ... please wait.")
 (command "line" pt1 pt2 "")
 (setq e (entlast))
 (repeat (length dist_list)
 (setq pt_next (polar pt1 a (car dist_list)))
 (command "copy" e "" pt1 pt_next)
 (setq pt1 pt_next)
 (setq dist_list (cdr dist_list))
 )
 (prompt "\ndone.")
 (setvar "cmdecho" 1)
 (setvar "osmode" osm)
 (princ)
 )

 

~'J'~

Posted

hey fixo, it works perfect.. Its really what I want. Thanks a million. :D

 

I hope you could also answer my other question next time.

Posted
hey fixo, it works perfect.. Its really what I want. Thanks a million. :D

 

I hope you could also answer my other question next time.

 

Glad to help and welcome on board

Feel free to ask what you need -

there are too much guys that will help you

include me, of course :)

Right now I have started on my own project though...

 

~'J'~

Posted

Thanks for welcoming me.. I appreciate it so much..:D

 

I posted another thread regarding my inquiry that you've answered recently.In case you haven't read it, I have a few questions I'd like to know.I hope I'm not bothering you.

 

I revised some part of your program and added a dialog box.I attached it here also for your info..

 

I know I'm asking too much but I hope you understand.

 

Thank you fixo..:)

Autogrid.LSP

grid.txt

Posted

Sorry I have not have enough time to help you

with explanations

Try this one instead, see comments inside the listing

of code

DCL file is the same you used

 

~'J'~

Autogrid_1.zip

Posted

your so good fixo.. you've done it exactly what i needed. It doesn't matter if you didn't explain it. I know you're doin also something very important so I understand.:)

 

Your program explain it well. Thanks also for the tips inside my lisp.

 

There are two more things though. I still don't know how to "mapcar" the grid name inside the circle and rectangle and also how to add up the dist_list value so that there will be no more "ox" and "oy" variable. Is it the same procedure as what have you done?

 

If it's not much to you, can you help me with it also? no need to rush, I can wait even if it takes you days do it.:)

 

How can i make it up to you? I owe u big time..:P

 

Thanks fixo...

Posted

Here is edited version, I have added the numbering only

Sorry, no more time to help you now

I stand crazy busy with my own project for my client

Hth

 

~'J'~

Autogrid_1.zip

Posted

Thanks fixo.. I really appreciate all your help..:)

 

Sorry if I bother you too much..

 

Again, thank you..

Posted
Thanks fixo.. I really appreciate all your help..:)

 

Sorry if I bother you too much..

 

Again, thank you..

No worries, please

Glad if this will save your time

Cheers :)

 

~'J'~

  • 7 years later...
Posted

Download grid.txt file and keep it on drive by renaming grid.dcl

 

and add support path of that directory in Options->files->support file and search path

 

e.g.

D:\satish\grid.dcl add support path D:\satish

 

and run the lisp again...

Posted

thanks a lot...but...i am searching for gridline like

 

i am civil engineer and i need something like this one...do U know link ?

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