• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

command running double offset of a line

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
I'm trying to write a program that runs the double offset of a line, I fucked a little but the result doesn't work.
Does anyone help me?
Code:
 (defun c:wpoint (/ os pt1 pt pttxy ptv ptv ptvett ptd ptdir distance)

(setvar "blipmode" 1)

(setq os (getvar "osmode")
(setvar "osmode" 8)
(setq pt1 (getpoint "\nselect the wpoint: ")
(Sectq pt (car pt1))
(setq ptt)
(setq ptxy (strcat (rtos pt 2 4) "," (rtos ptt 2 4))

(command "_circle" pt1 1.00 ")

(princ)
(princ ptvett)
(princ)
(setq ptv (getpoint))
(if ptvett (setq point ptv))
(command "_line" pt1 ptv ")
(setq line1 (entlast)

(princ)
(princ ptdir)
(princ)
(setq ptd (getpoint))
(if ptdir (setq point ptd)

(setq distance 30.00)

(vla-offset line1 distance)
(vla-offset line1 (- distance)

);
Grazieeeeeeeee!
 
Code:
(defunc c:offsetdouble(/ sel n pt distance p1 p2)
(setq sel (nentsel "\nsel select entity: ")
(setq distance 10)
(Sectq n (car sel))
(Sectq pt)
(command "_ucs" pt)
(setosnaponoff "off")
(setq p1 (trans (list 0 -100) 0 1))
(setq p2 (trans (list 0 100) 0 1))
(command "_ucs" "_w")
(command "_offset" distance n p1 ")
(command "_offset" distance n p2 ")
(setosnaponoff "on")
)

; turn on or off osnap, equivalent to f3 key
(defun setosnaponoff(mode/osmode)
(setq osmode (getvar "osmode")
(if)
(if) osmode 16384)
(Setvar "osmode" (- osmode 16384))
)
(if) osmode 16384)
(setvar "osmode" (+ osmode 16384))
)
)
)
selections entity, line or polyline, the distance imposed it in the distance variable.
with nentsel I get the name of the selected entity and the coordinate of the selected point.
through the imposed point the object that aligns according to the x axis, calculation 2 points along the y axis and through trans convert them into wcs points.
At this point I step up to the offset command the name of the entity and the first calculated point, I repeat with the second point.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
ciao
Back
Top