TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dussla on May 02, 2008, 02:14:51 AM
-
hello , friend
for help some , i come in theswamp
although i studied lisp , it is difficult to me
blelow routine :
1. to get lines( lw , polyline , arc ,,,, )'s start and end point
2. shorten some distance
3. break middle distance . then create 2 obj
4. first obj -> + 20 offset , second obj -> -20 offset
problem
if you see my routine , that is problme and must add some routine
(defun c:arpts()
(vl-load-com)
(setvar "osmode" 0 )
(setq ent (car (entsel "\nSelect : ")))
(setq ed (entget ent))
(setq db0 (cdr (assoc 0 ed)))
(setq D (getdist "\nEnter setback distance (negative to shorten): "))
(SETQ D ( * D -1))
(cond
( (= db0 "LINE")
(setq start (cdr (assoc 10 ed)))
(setq end (cdr (assoc 11 ed)))
(command "._lengthen" ent "de" D start end "")
(setq new-ent (entlast))
; NEED ROUTINE THAT ; BREAK OBJ'S MIDDLE
)
( (= db0 "LWPOLYLINE")
(setq Start (assoc 10 ed))
(setq End (assoc 10 (reverse ed)))
(command "._lengthen" ent "de" D start end "")
(setq new-ent (entlast))
; NEED ROUTINE THAT ; BREAK OBJ'S MIDDLE
)
( (= db0 "POLYLINE")
(setq OBJ (vlax-ename->vla-object ent ))
(setq objtype (vla-get-objectname obj))
(setq Start (vlax-get objtype "startpoint"))
(setq End (vlax-get objtype "endpoint") )
(command "._lengthen" ent "de" D start end "")
(setq new-ent (entlast))
; NEED ROUTINE THAT ; BREAK OBJ'S MIDDLE
)
( (= db0 "ARC")
(setq OBJ (vlax-ename->vla-object ent ))
(setq objtype (vla-get-objectname obj))
(setq Start (vlax-get objtype "startpoint"))
(setq End (vlax-get objtype "endpoint") )
(command "._lengthen" ent "de" D start end "")
(setq new-ent (entlast))
; NEED ROUTINE THAT ; BREAK OBJ'S MIDDLE
( (= db0 "CIRCLE")
)
);cond end
-
Try something like this:
(defun c:arpts (/ ent ed d start end)
(vl-load-com)
(setvar "osmode" 0)
(setq gap 20) ; 1/2 the actual gap
(if
(and
(setq ent (car (entsel "\nSelect : ")))
(setq ed (entget ent))
(member (cdr (assoc 0 ed)) '("LINE" "LWPOLYLINE" "POLYLINE" "ARC"))
(setq D (getdist "\nEnter setback distance (negative to shorten): "))
)
(progn
(setq start (vlax-curve-getstartpoint ent)
end (vlax-curve-getendpoint ent)
)
(command "._lengthen" ent "de" D "non" start "non" end "")
(setq middist
(/ (vlax-curve-getdistatpoint ent (vlax-curve-getendpoint ent))
2
)
)
(command "._break"
(list ent start)
"f"
(vlax-curve-getpointatdist ent (- midDist gap))
(vlax-curve-getpointatdist ent (+ midDist gap))
)
)
)
(princ)
)
-
thank you good lisp always
cab and other friends
my last purpose is to make 3d frame window.
can you see my attached file .
that is really ugly code for my poor coding and have many error.
but you can understand my purpose
can you help me again .
can you diet this code ~
problem :
1. there is gap in glass
2. some ucs error
3. glass position in frame : current ( frame out postion -> in frame middle )
that need glass postion offset
4. that image is single frame window , i need double window in frame
-
You may get some help but with a lisp this large it is better to break out a specific area where the problem is.
Then ask for help i a new thread for that problem.
-
cab , thank you good advice
i made compact code
but that is problem
1.
(rect-frame obj-1 40 zmove2 1) <---- ----------- this is work well
(vla-update (vlax-get-acad-object))
(setq start (vlax-curve-getstartpoint glass-obj) end (vlax-curve-getendpoint glass-obj) )
(command "._lengthen" glass-obj "de" -40 "non" start "non" end "")
(rect-frame glass-obj 10 ( - zmove2 ( * 40 2) ) 1) <---------------- but this is error error: unable to get ObjectID: nil
2. rect-frame is some ugly
pls can you modify some with compact :oops: :oops: :oops:
-
On what acad do you work on?
-
yes devig~
my purpose is 3d custome window making lisp
:-) :-) :-) :-)
-
yes devig~
my purpose is 3d custome window making lisp
:-) :-) :-) :-)
On what acad version do you work??
-
yes , i use acad 2004
i modified some cutome prompt
see attachted file~
-
dear cab and friends , thank you good help
i need one more time help again :oops:
cab
if you see your arpts fuction is very good
but i need more addition routine
pls help me
1. select entry
2. if i choose break number (ex: 5) , then entry broken
3. after that , all broken entities lenghten each with my wanted number
4. after that , i would liek to add all entries broken to 1 selection set
vlx funnction is difficult to me still :oops: :oops:
sorry my many ask
beg your pardon~