Offset of 2d or 3d closed polygon with different horizontal and vertical distance.

Offset of 2d or 3d closed polygon with different horizontal and vertical distance.

narasimharaoarza0211
Enthusiast Enthusiast
2,505 Views
39 Replies
Message 1 of 40

Offset of 2d or 3d closed polygon with different horizontal and vertical distance.

narasimharaoarza0211
Enthusiast
Enthusiast
  1. Required Offset for 2d or 3d closed polylines (Polygon ) with different horizontal and vertical distance.
  2. For example we have four (4) sides closed rectangle with 2d or 3d polylines.
  3. Offset for each side with different horizontal distance and vertical distance and the offset polyline should be closed.
  4. (Specify elevation difference or [Grade/Slope/Elevation] <0.000>: ) the same feature will be added for slope or elevation difference.  
0 Likes
Accepted solutions (1)
2,506 Views
39 Replies
Replies (39)
Message 2 of 40

Sea-Haven
Mentor
Mentor
Accepted solution

A 2 step process easy 

1st step offset

2nd step Move OBJ 0,0,0 0,0,Z  way easier than trying to get Z values of objects.

Message 3 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

good morning sir,

 Is there any direct lisp program for the following commend.

  1. For example we have four (4) sides closed rectangle with 2d or 3d polylines (same or different elevations).
  2. In one commend Offset should be made for each side with different horizontal distance and vertical distance and the offset polyline should be closed.
0 Likes
Message 4 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

;This is very lengthy program for one side offset to closed or open polygon (equal horizontal distance )up to 6 stages upper or lower , we required  multiple  side polygon to be offset simultaneous with varied  horizontal distance with respect to horizon of vertex.     

(defun dang (x / cosx) (setq cosx (cos x)) (if (/= cosx 0) (/ (sin x) cosx))
)
(defun c:pit ()
(prompt "This program is written by ksr.anjaneyulu")
(initget 7)
(setq no (getint "\nenter proposed no. of benchs <1 2 3 4 5 6>: "))
(setq slp (getangle "\nenter bench slope: "))
(setq ht (getint "\nenter proposed bench height: "))
(setq dist (* ht (/ 1 (dang slp))))
(setq wi (getreal "\nenter proposed bench width: "))
(setq elevation (getreal "\nenter proposed bench elevation <0>: ")) ; must enter 0
(setq vertical (getint "\nenter proposed bench vertical diff < -3 -5 -10 -15 30 >: "))
(setq dstlst (list dist wi))
(setq ve (list elevation vertical))
(setq ve1 (+ elevation vertical))
(setq d1 (car dstlst))
(setq d2 (cadr dstlst))
(if (= vertical -3) (setq mmm(list -3 -3 -6 -6 -9 -9 -12 -12 -15 -15 -18 -18)))
(if (= vertical -5) (setq mmm(list -5 -5 -10 -10 -15 -15 -20 -20 -25 -25 -30 -30)))
(if (= vertical -10) (setq mmm(list -10 -10 -20 -20 -30 -30 -40 -40 -50 -50 -60 -60)))
(if (= vertical -15) (setq mmm(list -15 -15 -30 -30 -45 -45 -60 -60 -75 -75 -90 -90)))
(if (= vertical 30) (setq mmm(list 30 30 60 60 90 90 120 120 150 150 180 180)))
(if (= no 1)
(setq dstlst1 (list d1 (+ d1 d2))))
(if (= no 2)
(setq dstlst1 (list d1 (+ d1 d2) (+ d1 d2 d1) (+ d1 d2 d1 d2))))
(if (= no 3)
(setq dstlst1 (list d1 (+ d1 d2) (+ d1 d2 d1) (+ d1 d2 d1 d2) (+ d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2))))
(if (= no 4)
(setq dstlst1 (list d1 (+ d1 d2) (+ d1 d2 d1) (+ d1 d2 d1 d2) (+ d1 d2 d1 d2 d1)
(+ d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2))))
(if (= no 5)
(setq dstlst1 (list d1 (+ d1 d2) (+ d1 d2 d1) (+ d1 d2 d1 d2) (+ d1 d2 d1 d2 d1)
(+ d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1 d2))))
(if (= no 6)
(setq dstlst1 (list d1 (+ d1 d2) (+ d1 d2 d1) (+ d1 d2 d1 d2) (+ d1 d2 d1 d2 d1)
(+ d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1 d2) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1 d2 d1) (+ d1 d2 d1 d2 d1 d2 d1 d2 d1 d2 d1 d2))))

(setq ss2 (car (entsel "\npick pit boundary: ")))
;ent(car ss2)
;elist(entget ent)
;eless2(assoc 38 elist)

(setq p3 (getpoint "\npick point on middle of the boundary: "))
(setq count 0)
(repeat (length dstlst1)
(command "offsetfeature" (nth count dstlst1) ss2 p3 (nth count mmm) "")
(setq count (1+ count))
;----------------------------------------------
;(setq ve1(- ve1 10))
;---------------------------------------------
)
(setq ss2 nil dstlst1 nil
)

(defun pboun ()
(command "area" "e" obj) (setq darea (getvar "area"))
(ssdel obj ss1)
)
(defun elim (ele lst)
(apply 'append (subst nil (list ele) (mapcar 'list lst))))


(defun adde (ele lst / tmp)
(if (= (type lst) 'SYM) (setq tmp lst lst (eval tmp)))
(setq lst (cond ((member ele lst) lst)
(t (cons ele lst))))
(if tmp (set tmp lst) lst)
)

(DEFUN C:dvol ()
(setq cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "plinegen" (getvar "plinegen"))
(setq darea 0)
(prompt "\nSelect only the dump boundary lines: ")

(setq ss1 (ssget))
(setq sd (sslength ss1)) (while (> (sslength ss1) 0)
(setq obj (ssname ss1 0))(setq ent (entget obj))
(setq et (cdr (assoc '0 ent)))
(cond ((= et "LWPOLYLINE") (pboun)) ((= et "POLYLINE") (pboun)) ((or (/= et "LWPOLYLINE") (/= et "POLYLINE"))(ssdel obj ss1)
)
)
(setq ara2 (append ara2 (list darea)))
(setq first (last ara2))
)
(setq ara2 (elim (last ara2) ara2))
(setq ara2 (adde first ara2))
(setq dump1 (* (/ (+ (nth 0 ara2) (nth 1 ara2)) 2) 30)

dump2 (* (/ (+ (nth 2 ara2) (nth 3 ara2)) 2) 30)

dump3 (* (/ (+ (nth 4 ara2) (nth 5 ara2)) 2) 30)

dump4 (* (/ (+ (nth 6 ara2) (nth 7 ara2)) 2) 30))

(setq dump dump1 dump (+ dump1 dump2) dump (+ dump1 dump2 dump3) dump (+ dump1 dump2 dump3 dump4)
)


(princ (strcat "The volume of dump = " (rtos (/ dump 1.2 1000000) 2 2) " " "Mbum")) (terpri)
(princ)
(setq ara2 nil)
(setq dump nil)
(setq dump1 nil dump2 nil dump3 nil ss1 nil dump4 nil)
)

)

0 Likes
Message 5 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

To run the program :

Command: rec RECTANG
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]:
Command: AP
APPLOAD pit.LSP successfully loaded.


Command:
Command:
Command: PIT
This program is written by ksr.anjaneyulu
enter proposed no. of benchs <1 2 3 4 5 6>: 6

enter bench slope: 70

enter proposed bench height: 10

enter proposed bench width: 30

enter proposed bench elevation <0>: 0

enter proposed bench vertical diff < -3 -5 -10 -15 30 >: -10

pick pit boundary:
pick point on middle of the boundary: offsetfeature Offset layer = Source

0 Likes
Message 6 of 40

john.uhden
Mentor
Mentor

@Sea-Haven 

How will you get Step 1 to work with a 3D poly?

John F. Uhden

0 Likes
Message 7 of 40

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

How will you get Step 1 to work with a 3D poly?


Exactly.  Since those can't be Offset, a different approach would be needed.  If they are always planar, presumably the "offset" could be accomplished by calculating corners and drawing a new one.  So, @narasimharaoarza0211, are they always planar, and always rectangular?  A small sample drawing with before and after would answer many questions.

Kent Cooper, AIA
0 Likes
Message 8 of 40

Kent1Cooper
Consultant
Consultant

@narasimharaoarza0211 wrote:

.... Offset for each side with different horizontal distance and vertical distance ....  


And just to clarify what I think you mean by that, and what it looks like others also think:

 

By "different horizontal distance and vertical distance," do you mean [I assume not, but what are usually meant by "horizontal" and "vertical"] different X-direction offset distance and Y-direction offset distance, or [this is what I assume] is the "horizontal" distance applicable to both the X and Y directions, and the "vertical" distance is in the Z direction?

Kent Cooper, AIA
0 Likes
Message 9 of 40

Sea-Haven
Mentor
Mentor

Yes 3dpolys are a problem. In Civil terms the request is a option in software like CIV3D.

 

Need to get all vertices of a 3dpoly and work out plan angles then can work out all new offset points. I am certain this exists already in another post will try to find. 

 

This took 2 seconds to find

SeaHaven_0-1657071083787.png

 

0 Likes
Message 10 of 40

narasimharaoarza0211
Enthusiast
Enthusiast
Good morning sir,
1. The above pit lisp can draw maximum up to 6 steeps up or down with equal horizontal distance.
a. enter bench slope: 70 ( i.e. ( 70 degrees) for 10m height the horizontal displacement is 3.64m)
b. enter proposed bench width: 30 ( i.e bench/ steep collider is 30m)
2. For each bench/ steep (30M with) is same elevation ( i.e. vertical difference)
a. enter proposed bench height: 10 (i.e the 1st bench/ steep to 2nd bench/ steep vertical difference is 10m ( inform of RL - 1st bench/ steep rl is 600 : then 2nd bench/ steep rl is 590)
3. In the program for 4sides, the horizontal offset was doing uniformly offsetting (or horizontal displacement) i.e 3.64 + 30 = 33.64.
4. But we required horizontal displacement for :
i. 1st side 3.36 + 30 = 33.64 ( 70degrees + 30m)
ii. 2nd side 1 + 20 = 21 m (45 degrees + 20M)
iii. 3rd side 3.64 + 20 = 23.64 m (70 degrees + 20M)
iv. 4th side 1 + 30 = 31 ( 45degrees + 30m)

5. The offset of one side and Xoffset for multy offsets with different distance for one side is also getting.
6. What is the commend for user defend multy offsets (horizontal) for 4sides or closed polygon.

How will you get Step 1 to work with a 3D poly?

• With Commend Offsetfeature

Note : enter proposed bench elevation <0>: Must enter 0


To run the program :
Command: rec RECTANG
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]:
Command: AP
APPLOAD pit.LSP successfully loaded.

Give elevation to rectangle I.e 600

Command:
Command:
Command: PIT
enter proposed no. of benchs <1 2 3 4 5 6>: 6
enter bench slope: 70
enter proposed bench height: 10
enter proposed bench width: 30
enter proposed bench elevation <0>: 0
enter proposed bench vertical diff < -3 -5 -10 -15 30 >: -10
pick pit boundary:
pick point on middle of the boundary: offsetfeature Offset layer = Source

0 Likes
Message 11 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

narasimharaoarza0211_0-1657091070661.png

 

0 Likes
Message 12 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

required plan

narasimharaoarza0211_1-1657092234931.png

 

0 Likes
Message 13 of 40

Kent1Cooper
Consultant
Consultant

If the image in Message 12 is the "required plan," what is the image in Message 11 for?  In Message 12, my question about X vs. Y offsets is made more complicated -- not just different X vs. Y offset distances, but different Y offset distances at the top of the shape than at the bottom?  How would the User input work for that?

Kent Cooper, AIA
0 Likes
Message 14 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

the above 6 offset method  is available  in civil3d ? 

0 Likes
Message 15 of 40

Sea-Haven
Mentor
Mentor

If you design a road you can make a template shape as a simple answer, if you want a pond with curves then it becomes more complicated merging into a design surface, the ultimate being a pond on a sloping surface which requires benching form a safety point of view plus say multiple batter slopes, Phew ! a mouth full, yes have done.

 

Not for a beginner "Civil site design" has some nice grading and batter tools.

0 Likes
Message 16 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

 

Good Moring sir,

 

We are studied the grading and batter tools, but it was not reached up to our target. We are trying to use the commend “variable offset 3d polyline” in place of "offsetfeature"  and we will change accordingly our lisp program.

 

The   “variable offset 3d polyline” commend : I used in Carlson software , it is most use full tool for us in the above lisp program.

Hence, I request you to provide me “variable offset 3d polyline” lisp

0 Likes
Message 17 of 40

Sea-Haven
Mentor
Mentor

 "I request you to provide me “variable offset 3d polyline” lisp".

 

Not a problem, we need to discuss fee.

0 Likes
Message 18 of 40

narasimharaoarza0211
Enthusiast
Enthusiast

Good Moring sir,

Ok, thankyou

It is a good commend, it should be incorporated in our Civil 3D

0 Likes
Message 19 of 40

Kent1Cooper
Consultant
Consultant

@narasimharaoarza0211 wrote:

.... It is a good commend, it should be incorporated in our Civil 3D


No one here can do anything about that.  You should suggest it at the >Product Feedback page< and/or the >Civil3D Ideas page<.

Kent Cooper, AIA
0 Likes
Message 20 of 40

john.uhden
Mentor
Mentor

Hi, @Kent1Cooper ,

This subject has been taxing my brain.  I think I've figured out how to do the 3D offset to the outside, but there's a limit as to how far you can offset to the inside.  With an irregular polygon you start losing vertices until there are only triangles created.  I wonder if I should bother writing the code for outside only.  Plus I would provide only one (1) slope, grade, or difference for all sides.

John F. Uhden

0 Likes