Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to offset line or figure with different distance

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Anonymous
784 Views, 8 Replies

How to offset line or figure with different distance

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?

8 REPLIES 8
Message 2 of 9
Alfred.NESWADBA
in reply to: Anonymous

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)
Message 3 of 9
Anonymous
in reply to: Alfred.NESWADBA

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

Message 4 of 9
Alfred.NESWADBA
in reply to: Anonymous

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)
Message 5 of 9
imadHabash
in reply to: Anonymous

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

Message 6 of 9
ВeekeeCZ
in reply to: Anonymous

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.

 

Message 7 of 9
Anonymous
in reply to: ВeekeeCZ

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.

 

Message 8 of 9
ВeekeeCZ
in reply to: Anonymous

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. 

Message 9 of 9
Anonymous
in reply to: ВeekeeCZ

Thank you for your reply.

I will try to learn LISP for next work.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report