what function missing in this lisp

what function missing in this lisp

Anonymous
Not applicable
1,184 Views
13 Replies
Message 1 of 14

what function missing in this lisp

Anonymous
Not applicable

hi everyone.

i attached the lisp.

kindly help this problem as shown below.

1.when i do the first time in the drawing totally collapsed itself. i don't know why appears it's like this after that second time it looks good. 

2. In this lisp, some information missing I am pretty sure, i wanna put equal spacing for stirrups, but, so many times i tried. it did not come. what is wrong in this lisp?

thanks advance

hussain

 

(defun c:oi ()

(defun dtr (a)
(* pi (/ a 180.0))
)
(setq blen (getdist "\nenter basement the length: "))
(setq bht (getdist "\nenter basement the height: "))
(setq colht (getdist "\nenter the column height: "))
(setq colw (getdist "\nenter the column width: "))
(setq spc (getdist "\nenter the space the stirups: "))
(setq stirups (getint "\nenter the no.stirups: "))
(setq i 0)
(setq sp (getpoint "\npick point: "))

(setq p1 (polar sp (dtr 0.0) blen))
(setq p2 (polar p1 (dtr 90.0) bht))
(setq p3 (polar p2 (dtr 180.0) (- (/ blen 2) (/ colw 2))))
(setq p4 (polar p3 (dtr 90.0) colht))
(setq p5 (polar p4 (dtr 180.0)colw))
(setq p6 (polar p5 (dtr 270.0)colht))
(setq p7 (polar p6 (dtr 180.0) (- (/ blen 2) (/ colw 2))))

(command "line" sp p1 p2 p3 p4 p5 p6 p7 "c")
(repeat stirups

(setq o (list (car p6) (+(cadr p6)i) ))
(setq l (list (car p3) (+(cadr p3)i) ))

(command "line" o l "")

(setq i (+ spc i))
)
(princ)
)

 

 

 

 

 

0 Likes
Accepted solutions (1)
1,185 Views
13 Replies
Replies (13)
Message 2 of 14

ВeekeeCZ
Consultant
Consultant

The LINE command does not have any "c" option as for Closing or what. You've probably wanted to make a Pline.

 


@Anonymous wrote:

hi everyone.

i attached the lisp.

kindly help this problem as shown below.

1.when i do the first time in the drawing totally collapsed itself. i don't know why appears it's like this after that second time it looks good. 

2. In this lisp, some information missing I am pretty sure, i wanna put equal spacing for stirrups, but, so many times i tried. it did not come. what is wrong in this lisp?

thanks advance

hussain

 

(defun c:oi ()

(defun dtr (a)
(* pi (/ a 180.0))
)
(setq blen (getdist "\nenter basement the length: "))
(setq bht (getdist "\nenter basement the height: "))
(setq colht (getdist "\nenter the column height: "))
(setq colw (getdist "\nenter the column width: "))
(setq spc (getdist "\nenter the space the stirups: "))
(setq stirups (getint "\nenter the no.stirups: "))
(setq i 0)
(setq sp (getpoint "\npick point: "))

(setq p1 (polar sp (dtr 0.0) blen))
(setq p2 (polar p1 (dtr 90.0) bht))
(setq p3 (polar p2 (dtr 180.0) (- (/ blen 2) (/ colw 2))))
(setq p4 (polar p3 (dtr 90.0) colht))
(setq p5 (polar p4 (dtr 180.0)colw))
(setq p6 (polar p5 (dtr 270.0)colht))
(setq p7 (polar p6 (dtr 180.0) (- (/ blen 2) (/ colw 2))))

(command "pline" sp p1 p2 p3 p4 p5 p6 p7 "c")
(repeat stirups

(setq o (list (car p6) (+(cadr p6)i) ))
(setq l (list (car p3) (+(cadr p3)i) ))

(command "line" o l "")

(setq i (+ spc i))
)
(princ)
)

 

 

 

 

 


 

0 Likes
Message 3 of 14

Anonymous
Not applicable

hi beekeez

i tried already that one what you mentioned, but it did not come correctly. see the image which one i attached.

did you check my lisp?

 

thanks

hussain 

0 Likes
Message 4 of 14

ВeekeeCZ
Consultant
Consultant

That's another thing. Always turn off osnaps!!!

 

BTW I wouldn't know what is correct output. You gotta give some real measurements.

0 Likes
Message 5 of 14

Anonymous
Not applicable

hi beekeecz

thank you so much it works fine.no matter output, but i wanna know. why did not work? anyway, it works fine.

##another question.

how to add measure command for a particular point for instance (point p3 & p4) then connect line horizontally like stirrups.

 

thanks 

hussain

0 Likes
Message 6 of 14

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

hi beekeecz

thank you so much it works fine.no matter output, but i wanna know. why did not work? anyway, it works fine....



Not sure what else I can add than I already explained.

 

 


@Anonymous wrote:

.... how to add measure command for a particular point for instance (point p3 & p4) then connect line horizontally like stirrups...


 

If you need to get a distance of two points use this: (distance p3 p4)

 

 


0 Likes
Message 7 of 14

Kent1Cooper
Consultant
Consultant

@ВeekeeCZ wrote:

The LINE command does not have any "c" option as for Closing or what. ....


 

It most certainly does!  But not until you've made at least two  Lines, which is different from PLINE in which you can Close after only one segment.

LineClose.PNG

Closing a LINE command after drawing only one would just make another lying on top of the first one, which is probably why it doesn't offer that option until at least two, whereas because of the possibility of arc  segments, closing a Polyline after one segment isn't necessarily redundant in that way.

Kent Cooper, AIA
Message 8 of 14

ВeekeeCZ
Consultant
Consultant

Ohh, my bad. I see... Thanks!

0 Likes
Message 9 of 14

scot-65
Advisor
Advisor
If you have a fixed number of points, try this instead of messing with OSNAP.

(command-s "line" "_non" sp "_non" p1 "_non" p2 "_non" p3 "_non" p4 "_non" p5 "_non" p6 "_non" p7 "c")

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 10 of 14

Anonymous
Not applicable

sorry for the delay because yesterday our office off, so i cannot reply to anyone.

 

hi scot-65

thank you so much for your reply. it is a good one.i will use this for my lisp.

i have another question about "offset" command. using multiple offsets by given distance.this is I think, if not. pls correct me(command "offset" offset distance, select object,"m"(multiple offset) "" ).is this correct one?

 

 

 

thanks to everyone those who reply to me.

 

thanks 

 

0 Likes
Message 11 of 14

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

here is a correct code but in this case you will not achieve much, better run the original command.

 

moshe

 

 

 (if (setq ofd (getdist "\nOffset distance: "))
  (command-s "._offset" ofd pause "_m")
 )
Message 12 of 14

Anonymous
Not applicable

hi moshe

thank you so much your reply.

your function little bit helps me, but when i execute lisp showing unknown command. why it's showing? kindly help.

i have shown below for your reference.


@Moshe-A wrote:

@Anonymous  hi,

 

here is a correct code but in this case you will not achieve much, better run the original command.

 

moshe

 

 

 (if (setq ofd (getdist "\nOffset distance: "))
  (command-s "._offset" ofd pause "_m")
 )

for checking.JPGthanks 

 

 

hussainfor checking.JPG 

 

(defun c:oi ()

(defun dtr (a)
(* pi (/ a 180.0))
)
(setq blen (getdist "\nenter basement the length: "))
(setq bht (getdist "\nenter basement the height: "))
(setq colht (getdist "\nenter the column height: "))
(setq colw (getdist "\nenter the column width: "))
(setq spc (getdist "\nenter the space the stirups: "))
(setq of (getreal "\nenter the offset distance: "))

(setq stirups (getint "\nenter the no.stirups: "))
(setq i 0)
(setq sp (getpoint "\npick point: "))

(setq p1 (polar sp (dtr 0.0) blen))
(setq p2 (polar p1 (dtr 90.0) bht))
(setq p3 (polar p2 (dtr 180.0) (- (/ blen 2) (/ colw 2))))
(setq p4 (polar p3 (dtr 90.0) colht))
(setq p5 (polar p4 (dtr 180.0) colw))
(setq p6 (polar p5 (dtr 270.0) colht))
(setq p7 (polar p6 (dtr 180.0) (- (/ blen 2) (/ colw 2))))

(command "line" sp p1 p2 p3 p4 p5 p6 p7 "c")
(repeat stirups
(setq o (list (car p6) (+ (cadr p6) i)))
(setq l (list (+ (car p6) colw) (+ (cadr p6) i)))

(command "line" o l "")
;(command "offset" offa sp p1 "")

(setq i (+ i spc))
(command "offset" of o l pause "m" "" )


)


(princ)
)

 

0 Likes
Message 13 of 14

dbhunia
Advisor
Advisor
Accepted solution

Another way (roughly modified) ....... try like this .......

 

(defun c:oi ()

(defun dtr (a)
(* pi (/ a 180.0))
)
(setq blen (getdist "\nenter basement the length: "))
(setq bht (getdist "\nenter basement the height: "))
(setq colht (getdist "\nenter the column height: "))
(setq colw (getdist "\nenter the column width: "))
(setq spc (getdist "\nenter the space the stirups: "))
(setq of (getreal "\nenter the offset distance: "))
(setq stirups (getint "\nenter the no.stirups: "))
;(setq i 0)
(setq sp (getpoint "\npick point: "))

(setq osm (getvar "osmode"))
(setvar "osmode" 0)

(setq p1 (polar sp (dtr 0.0) blen))
(setq p2 (polar p1 (dtr 90.0) bht))
(setq p3 (polar p2 (dtr 180.0) (- (/ blen 2) (/ colw 2))))
(setq p4 (polar p3 (dtr 90.0) colht))
(setq p5 (polar p4 (dtr 180.0) colw))
(setq p6 (polar p5 (dtr 270.0) colht))
(setq p7 (polar p6 (dtr 180.0) (- (/ blen 2) (/ colw 2))))

(command "pline" sp p1 p2 p3 p4 p5 p6 p7 "c")

(repeat stirups 
(command "line" p3 p6 "")
(command "copy" (entlast) "" p6 (polar p6 (dtr 90.0) of))
(setq p3 (polar p3 (dtr 90.0) spc))
(setq p6 (polar p6 (dtr 90.0) spc))
)
(setvar "osmode" osm)

(princ)
)

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 14 of 14

Anonymous
Not applicable

@dbhunia wrote:

Another way (roughly modified) ....... try like this .......

 

(defun c:oi ()

(defun dtr (a)
(* pi (/ a 180.0))
)
(setq blen (getdist "\nenter basement the length: "))
(setq bht (getdist "\nenter basement the height: "))
(setq colht (getdist "\nenter the column height: "))
(setq colw (getdist "\nenter the column width: "))
(setq spc (getdist "\nenter the space the stirups: "))
(setq of (getreal "\nenter the offset distance: "))
(setq stirups (getint "\nenter the no.stirups: "))
;(setq i 0)
(setq sp (getpoint "\npick point: "))

(setq osm (getvar "osmode"))
(setvar "osmode" 0)

(setq p1 (polar sp (dtr 0.0) blen))
(setq p2 (polar p1 (dtr 90.0) bht))
(setq p3 (polar p2 (dtr 180.0) (- (/ blen 2) (/ colw 2))))
(setq p4 (polar p3 (dtr 90.0) colht))
(setq p5 (polar p4 (dtr 180.0) colw))
(setq p6 (polar p5 (dtr 270.0) colht))
(setq p7 (polar p6 (dtr 180.0) (- (/ blen 2) (/ colw 2))))

(command "pline" sp p1 p2 p3 p4 p5 p6 p7 "c")

(repeat stirups 
(command "line" p3 p6 "")
(command "copy" (entlast) "" p6 (polar p6 (dtr 90.0) of))
(setq p3 (polar p3 (dtr 90.0) spc))
(setq p6 (polar p6 (dtr 90.0) spc))
)
(setvar "osmode" osm)

(princ)
)

 


hi dbhunia

thank you so much. it works fine.

Insha Allah, i will use this code particularly (copy function) for my next lisp . it just really helping me.

i appreciate your help.

regards 

hussain

0 Likes