dynamic block for fence

dynamic block for fence

jdfnnl
Advocate Advocate
1,902 Views
9 Replies
Message 1 of 10

dynamic block for fence

jdfnnl
Advocate
Advocate

Is there a way to take this linear array dynamic block and configure it to always have a post at each end?

Ideally this would center the posts so the distance between posts at either end would be equal

but not less than 4'

OR would this be easier to accomplish with a custom linetype with the 'A' alignment parameter?

0 Likes
1,903 Views
9 Replies
Replies (9)
Message 2 of 10

jdfnnl
Advocate
Advocate

the goal is a block like this,

 

2023-05-09 07_57_11-Autodesk AutoCAD 2015 - [531 Living Oak.dwg].png

but one that will fit not only 8' increments and will center the posts between the ends.

0 Likes
Message 3 of 10

timothy_crouse
Collaborator
Collaborator

One technique would be:

 

Create a fence template with (3) posts, One at each end and one in the middle

 

Have the post spacing set as required

 

Add a STRETCH to the end post, include the fence and post in the selection

 

Add an array to the mid post and end fence segment.

 

Hope this gets you on your way

-Tim C.

0 Likes
Message 4 of 10

jdfnnl
Advocate
Advocate

@timothy_crouse thinking I will do this but leave off the third post where the next segment would fill in.

 

could probably use another hint continuing on:

1 - way to add a partial segment of fence after last post between array increments?

2 - centering linear array in associated linear parameter?

 

- current block attached -

 

2023-05-09 12_23_50-Autodesk AutoCAD 2015 - [531 Living Oak.dwg].png

0 Likes
Message 5 of 10

jdfnnl
Advocate
Advocate

actually thinking I would opt to draw the corner posts separately to tweak their rotation individually

therefore the goal is mainly how to produce a centered linear array with equal lines on either end

 

2023-05-09 12_31_49-Autodesk AutoCAD 2015 - [531 Living Oak.dwg].png

0 Likes
Message 6 of 10

GeeHaa
Collaborator
Collaborator

I thought a lisp routine might help you. This routine creates a group NOT a dynamic block but it gets the spacing the way you want it. You should check out groups as alternatives to blocks. If you don't want a group created you can put a ";" in front of this line ;(command "._group" "c" "*" "Fence" e1 "") like so. It will then create polylines that you can adjust. Groups can be adjusted too, it just takes a little more effort. I like to save my lisps to Documents\Lisp folder but you can download it save it anywhere. When you are ready to use it just drag it from file explorer onto your drawing and type Fence on the command line. Follow the instructions on the command line to use it. 

See attached lisp file Fence.lsp below. If you find it useful you can put it in your startup suite ("APPLOAD")so all you have to do is type "Fence" on the command line whenever you want to use it. I hope this helps.

0 Likes
Message 7 of 10

timothy_crouse
Collaborator
Collaborator

To add a partial segment at the end you could do one of the following:

 

-Add a visstate that hides or shows the end segment as required:

--The end segment should have a stretch control to allow you to adjust the length as required

--Add the End segment and stretch control to the Fence Post stretch control,  EG the end fence post control will not only adjust the last full segment but it will be used to move the partial end segment too.

 

Add a partial end segment stretch control and set the min length to .001 this would allow you to hide the partial end segment by making it really short.,

 

You would still need to add the partial end segment to the End Fence Post Stretch control.

 

Another option is you simply draw a pline for the fence boundary.

Then create a fence post rectangle and covert it to a wipeout.

Then array the wipe out post along the fence line using array path.

 

 

 

-Tim C.

 

 

 

0 Likes
Message 8 of 10

GeeHaa
Collaborator
Collaborator

I had some time today, I made the routine more logical. It should now handle most of your conditions. Example: If the space between the end  posts is too small it splits the fence giving you 2 smaller (equal) segments on each side. You determine the minimum length. (its a question the program asks). To use it, follow the instructions in my previous post, Type fence on the command line and hit a start point and an end point. Enter your post size or hit enter for 4". Enter your standard segment length or hit enter for 8', Enter the minimum distance between posts or hit enter for 24". You won't be able to stretch it like a dynamic block but being its a group you can select it with one click, erase it and draw it bigger or smaller by running it again.

0 Likes
Message 9 of 10

jdfnnl
Advocate
Advocate

@GeeHaa Somewhat regrettably, I went back to linetypes because of its comparative simplicity. Actually mainly because I noticed that when stretching, the distance between shapes remains constant. Using the stock linetype 'FENCELINE2' scaled to 1.25 with 'global scale factor' 16 gives a post 4" square. 

 

 

*FENCELINE3,Fenceline square ----[]-----[]----[]-----[]----[]---
A,4.8,-.1,[BOX,ltypeshp.shx,x=-.1,s=.1],-.1

 

 

Then having the only 'pen down' length located before the shape centers the posts between the end points and adjusting this factor to 4.8 gives 8'-0" distance between the posts. It actually works exactly as intended with the lines on either end stretching between 4' and 8' and those between remain constant.

 

@timothy_crouse this wipeout idea prevents trimming at the corner posts!

0 Likes
Message 10 of 10

timothy_crouse
Collaborator
Collaborator

FYI, there is a standard acad fence line type in standard acad.

0 Likes