Divide line / creating snap points

Divide line / creating snap points

Anonymous
Not applicable
2,895 Views
16 Replies
Message 1 of 17

Divide line / creating snap points

Anonymous
Not applicable

Hello,

 

I'm wondering if it's possible to write a command / lisp that does the calculation of the excel sheet I've attached to this post. I'm too lazy to open excel all the times to do this calculation and insert the distance manually :p.

I want to divide a certain distance (lines, edges of gardens in real life) into segments depending on a sprinkler radius. The outcome of al the calculations should be distance between sprinkler points. See additional information in the sheet. 

 

I hope the excel sheet is clear. Don't hesitate to ask if you've got any questions.

 

Kinds regards,

 

Niels 

 

0 Likes
Accepted solutions (1)
2,896 Views
16 Replies
Replies (16)
Message 2 of 17

devitg
Advisor
Advisor

@Anonymous , hi . please upload the sample.dwg where yo want to apply such task 

0 Likes
Message 3 of 17

Sea-Haven
Mentor
Mentor

Did you goggle sprinkler design there is a lot of stuff out there for this task. At least like devitg post a dwg 

0 Likes
Message 4 of 17

john.uhden
Mentor
Mentor

Can't you just use the DIVIDE command and set your object snap to node?

John F. Uhden

0 Likes
Message 5 of 17

Anonymous
Not applicable

Here's the example.dwg. I hope you can see the sprinklers in the correct way because they are a dataflor block. 

 

I'm using the  divide command now in combination with the excel sheet. It works but it's a lot of switching between excel and autocad and manual calculations. That's the reason why I'm interested in an automatic way if possible.

 

I've used google but couldn't found anything of use so far. 

0 Likes
Message 6 of 17

devitg
Advisor
Advisor

@Anonymous Please upload a true real dwg when you use 

this values 

 

devitg_0-1589491525875.png

 

And the way you do it , if by "hand" or some LISP. 

 

 

0 Likes
Message 7 of 17

Sea-Haven
Mentor
Mentor

When you say a google found nothing I am surprised, a google found heaps of info only spent like 2 mins.

 

There is definitely lisp routines out there up to commercial versions.

0 Likes
Message 8 of 17

Kent1Cooper
Consultant
Consultant
Accepted solution

I think you should be able to use the DIV+ command in DivideMeasurePlus.lsp, available >here<.  It is a super-charged Divide command, with many enhancements over what regular DIVIDE can do.  The ones you will be interested in are:

 

1)  It has the option of a Maximum spacing between the [in your case] Block insertions.  You would use twice the sprinkler-coverage radius.  It will calculate how many are needed to cover the length in the fewest insertions such that the spacing does not exceed that Maximum.

 

2)  EDITED after re-reading notes in spreadsheet:  It has the option to place insertions at the ends  of the path object, which would be your 90-degree head locations.

 

You need a path object covering the full extent in one piece [anything with linearity -- Line, Arc, Polyline, Circle, Spline, Ellipse].  Given that, all you need is to select it and use twice that radius as described -- it will figure out all the rest for you, without the need for the spreadsheet.

 

If you use a different Block  at the ends of the range, you can use the through-the-middle Block in DIV+, without  the put-them-at-the-ends option, and use the end-type Blocks in another DIV+ command, calling for 1 segment  [another thing regular DIVIDE can't do] instead of the Maximum option, with  the at-the-ends option.

Kent Cooper, AIA
0 Likes
Message 9 of 17

Anonymous
Not applicable

Kent1Cooper,

 

You're a hero!! the div+ works really fine for me 🙂 Just a note, but that's for the detail: The maximum spacing should be 1.3 x radius, as the sprinklers needs to overlay 70%. But that's an easy calc I can do without a spreadsheet 🙂

 

Is it correct that using div+ changes my snap settings (it turns all of them of and even removed my selection) or am I doing something wrong?

 

Thanks for sharing this lisp 🙂 

0 Likes
Message 10 of 17

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

Is it correct that using div+ changes my snap settings (it turns all of them of and even removed my selection) or am I doing something wrong?

....


It was written before the (command-s) function existed, and before [at Acad2016, I think?] the use of the "plain" (command) function in *error* handlers  was frowned upon.  I'm guessing that you are ending it with ESCape, and you're getting an error message -- you should do just what it suggests:

 

Change this line [near the top, in the (dmerror) function definition]:

  (command "_.undo" "_end")

 

to this:

 

  (command-s "_.undo" "_end")

 

and likewise change [a few lines above, but less likely to be the source of the problem because less likely to be the situation]:

 

  (if ucschanged (command "_.ucs" "_prev"))

 

to:

 

  (if ucschanged (command-s "_.ucs" "_prev"))

 

Even without making that change, it should still work as expected if  you end it with Enter or space, rather than ESCape, because then the *error* handler will not be called for.

Kent Cooper, AIA
0 Likes
Message 11 of 17

Anonymous
Not applicable

Hello Kent,

 

I hope you're willing to help me again. I've been using div+ for a while now and it still does the job it has to do 🙂 But I'm wondering if it could be written a little bit easier, with less prompts that should be giving in:

 

- Divide with points / blocks / lines / selections: I always use points

- Layer for the points: I always use current

- Enter number of segments or maximum spacing: Always maximum spacing

- Maximum spacing of points: different  

- place points at division points (standard) or at midpoints of division : always at division points (standard).

-insert from both ends of path to endmost points: always zero

- place points at end of unclosed path: always yes 

 

Could/would you rewrite or delete the other questions to simplify it a little bit?

0 Likes
Message 12 of 17

Sea-Haven
Mentor
Mentor

Here in AUS the fee its called a slab of beer.

0 Likes
Message 13 of 17

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... I'm wondering if it could be written a little bit easier, with less prompts that should be giving in:

 

- Divide with points / blocks / lines / selections: I always use points

- Layer for the points: I always use current

- Enter number of segments or maximum spacing: Always maximum spacing

- Maximum spacing of points: different  

- place points at division points (standard) or at midpoints of division : always at division points (standard).

-insert from both ends of path to endmost points: always zero

- place points at end of unclosed path: always yes 

 

Could/would you rewrite or delete the other questions to simplify it a little bit?



I simplifies [and shortens] it quite a lot, actually.  Try the attached DivideMaxPoints.lsp with its DMP command.  Lightly  tested [I didn't try every possible entity type in different UCS, etc.].

 

One change beyond the simplification is that this one allows you to select as many things as you want thus divided, all at once, rather than one at a time.  [The other did one at a time, so it could check for validity of each object in relation to the various options, and ask again if something was inappropriate.  But this merely filters for appropriate entity types, and because of the elimination of certain options, it can always proceed with anything that qualifies under the selection filtering.]

Kent Cooper, AIA
Message 14 of 17

Anonymous
Not applicable

Hi Kent,

 

This is great and does the job 🙂

 

Just one more (stupid?) question 

 

when I zoom in and out the points change size. Unfortunately they do not automatically change back. See image below. Do I have a setting wrong somewhere in autocad? Is it possible that they always remain the same size? (the original insert size as in the first image).

original size.pngafter zooming.png

Message 15 of 17

Anonymous
Not applicable

@Anonymous 

 

look at PTYP settings

0 Likes
Message 16 of 17

Anonymous
Not applicable

Found the solution already in the pdsize 🙂 

0 Likes
Message 17 of 17

john.uhden
Mentor
Mentor
DDPTYPE
Choice of...
Set Size Relative to Screen
Set Size in Absolute Unis

John F. Uhden

0 Likes