How to offset line or figure with different distance

Anonymous

How to offset line or figure with different distance

Anonymous
Not applicable

Hello??

 

I'm in problem to draw offset in different distance like this example

캡처 (1).PNG캡처.PNG

 

This is just example

I hope to draw squares or lines over about 10,000 ...

So I need to know how to draw offset in different distance automatically.. 

I searched a lot.. but I can't find good solution to solve this.

My autocad version is 2014... So I can't use good apps that can be useful for offset.. 

 

Do you have any idea?

0 Likes
Reply
Accepted solutions (1)
788 Views
8 Replies
Replies (8)

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

why opening a new (3rd) thread for the same question, please stay in the thread where you already have suggestions, ideas, and a communication with others.

Creating a new thread only means more work for all of us ... you too.

 

Please stay and continue >>>here<<<

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)

Anonymous
Not applicable

Sorry,,  I thought my post was deleted... 

0 Likes

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I thought my post was deleted... 

Posts here are never deleted (as long as they match with general forum rules).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes

imadHabash
Mentor
Mentor

Hi,

>> I searched a lot.. but I can't find good solution to solve this.

True ... and you won't find,especially after three or four posts that goes around the same issue .  So i suggest to mange well your time and start your drawing .  🙂

 

Imad Habash

EESignature

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

Well, it's not that difficult to program, 20-30 mins. 

 

(vl-load-com)

(defun c:OffsetMultipleFile ( / *error* file lst line ss i o el+ el- ar+ ar- +/-)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if file (close file))
    (princ))
  
  ; --------------------------------------------------------------------
  
  (if (setq file (open (strcat "c:\\Users\\OffsetMultipleFile.txt") "r"))  ;; se file name
    (while (setq line (read-line file))
      (setq lst (cons (atof line) lst))))
  
  (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE,CIRCLE,ARC"))))
    (repeat (setq i (sslength ss))
      (setq o (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
      
      (if (vl-catch-all-error-p (setq el+ (vl-catch-all-apply 'vla-offset (list o (car lst)))))
	(setq el+ nil))
      (if (vl-catch-all-error-p (setq el- (vl-catch-all-apply 'vla-offset (list o (- (car lst))))))
	(setq el- nil))
      
      (if (setq +/- (cond ((and el+ (not el-))			+)
			  ((and (not el+) el-)			-)
			  ((not (and (not (vl-catch-all-error-p (setq ar+ (vl-catch-all-apply 'vla-get-area (list el+)))))
				     (not (vl-catch-all-error-p (setq ar- (vl-catch-all-apply 'vla-get-area (list el-)))))))
			   					nil)
			  ((> ar+ ar-)				+)
			  ((< ar+ ar-)   			-)
			  (T					nil)))
	(foreach d lst (vla-offset o (+/- d))))
      (vl-catch-all-apply 'vla-delete (list el+))
      (vl-catch-all-apply 'vla-delete (list el-))
      ))
  (princ)
  )

File: offset from the original object per line.

 

0 Likes

Anonymous
Not applicable

Thanks for your reply.. 

 

Actually,, I solved this problem during weekend without that code you wrote.

I appreciate many comment here including you. 

Thinking of other ways to solve this problem, I found it way using an coordinate..

I used copy function not offset..

I didn't know I can use copy function to make copies in the desired multi point that I commented as multiple offset.

It made my work easy

 

By the way,, How could I learn programming for autocad?

I heard this is called VBA... right?

 

Thank you for every one.

 

0 Likes

ВeekeeCZ
Consultant
Consultant

It's a LISP. Probably the best place to start is HERE 

Also, HELP  is a necessity.

 

But before learning to program it's important to know well the SW itself. 

0 Likes

Anonymous
Not applicable

Thank you for your reply.

I will try to learn LISP for next work.

0 Likes