N73dp Posted May 17, 2014 Posted May 17, 2014 (edited) Hi dear members, i need to do side and top view of this detail,and bolt must be from 2 to 8?user must choose. I did something like this and don't know what to do next.Help please/ (setq K_center(getpoint "Центр крышки") K_radius(getreal "Радиус крышки") K_circle_count(getint "Колличество отверстий")) (setq K_radius_inLL (- K_radius (* K_radius (/ 3.0 5.0)))) (setq K_radius_inL (- K_radius (* K_radius (/ 4.0 5.0)))) (setq K_radius_inF (/ K_radius (/ 5.0 7.0))) (setq K_radius_inS (- K_radius_inF (- K_radius K_radius_inF))) (setq K_rad_in_dist (- K_radius_inS K_radius_inF)) (setq K_circl_in_x (nth 0 K_center)) (setq K_circl_in_y (+ (nth 1 K_center) (- K_radius_inS (/ K_rad_in_dist 2.0)))) (setq K_circl_point (list K_circl_in_x K_circl_in_y)) (setq K_circl_rad (- (/ K_rad_in_dist 2.0) (/ K_radius_inS 20.0))) (setq K_circl_mass_point (list K_circl_in_x (+ K_circl_in_y K_circl_rad))) (setq K_circl_inL_x (nth 0 K_center)) (setq K_circl_inL_y (+ (nth 1 K_center) K_radius_inL)) (setq K_circl_inLL_x (nth 0 K_center)) (setq K_circl_inLL_y (+ (nth 1 K_center) K_radius_inLL)) (setq K_circl_inL_point (list K_circl_inL_x K_circl_inL_y)) (setq K_circl_inLL_point (list K_circl_inLL_x K_circl_inLL_y) Edited May 19, 2014 by N73dp Quote
neophoible Posted May 19, 2014 Posted May 19, 2014 I recommend providing a DWG (with labels) of what you are trying to accomplish. It looks like a hole/bolt pattern in a round cover. Are you just doing 2D or do you want 3D results? Quote
N73dp Posted May 19, 2014 Author Posted May 19, 2014 (edited) I need 2D model... This is complete lisp – code of the top view ( first picture);and this is side view( second picture) that needs a code. The side view should depend on top view, that is, if the radius of the cover from above is 500, the length of a side view should be 1000. Code - lisp first picture: (setq K_center(getpoint "center of the lid") K_radius(getreal "The radius of the lid") K_circle_count(getint "Number of Holes")) (setq K_radius_inLL (- K_radius (* K_radius (/ 3.0 5.0)))) (setq K_radius_inL (- K_radius (* K_radius (/ 4.0 5.0)))) (setq K_radius_inF (/ K_radius (/ 5.0 7.0))) (setq K_radius_inS (- K_radius_inF (- K_radius K_radius_inF))) (setq K_rad_in_dist (- K_radius_inS K_radius_inF)) (setq K_circl_in_x (nth 0 K_center)) (setq K_circl_in_y (+ (nth 1 K_center) (- K_radius_inS (/ K_rad_in_dist 2.0)))) (setq K_circl_point (list K_circl_in_x K_circl_in_y)) (setq K_circl_rad (- (/ K_rad_in_dist 2.0) (/ K_radius_inS 20.0))) (setq K_circl_mass_point (list K_circl_in_x (+ K_circl_in_y K_circl_rad))) (setq K_circl_inL_x (nth 0 K_center)) (setq K_circl_inL_y (+ (nth 1 K_center) K_radius_inL)) (setq K_circl_inLL_x (nth 0 K_center)) (setq K_circl_inLL_y (+ (nth 1 K_center) K_radius_inLL)) (setq K_circl_inL_point (list K_circl_inL_x K_circl_inL_y)) (setq K_circl_inLL_point (list K_circl_inLL_x K_circl_inLL_y)) (command "CIRCLE" K_circl_point K_circl_rad) (command "CIRCLE" K_center K_radius_inL) (command "CIRCLE" K_center K_radius_inLL) (command "CIRCLE" K_center K_radius) (command "CIRCLE" K_center K_radius_inF) (command "CIRCLE" K_center K_radius_inS) (command "HATCH" "SOLID" K_circl_inL_point K_circl_inLL_point "") (command "POLARARRAY" K_circl_mass_point "" K_center "О" K_circle_count "" "CLOSE") Edited May 19, 2014 by N73dp Quote
neophoible Posted May 19, 2014 Posted May 19, 2014 How about a pic with labels? It looks like you want a cover with holes in it. You get the center and radius, then the number of holes. Does that mean everything else is dependent on those dimensions? For example, the placement of the holes, the size of the holes, the thickness of the cover, etc.? Quote
neophoible Posted May 19, 2014 Posted May 19, 2014 By the way, you need to put your code in Code Tags: http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines Quote
N73dp Posted May 19, 2014 Author Posted May 19, 2014 if you change the radius of the lid from the top, and side view should change. Quote
N73dp Posted May 19, 2014 Author Posted May 19, 2014 How about a pic with labels? It looks like you want a cover with holes in it. You get the center and radius, then the number of holes. Does that mean everything else is dependent on those dimensions? For example, the placement of the holes, the size of the holes, the thickness of the cover, etc.? Yes it's right.Can i take some help from you? Quote
BIGAL Posted May 20, 2014 Posted May 20, 2014 Have you looked at constraints ? Then everything is a relation to something else change radius and part updates. Dynamic block ? Change master hole diameter other 3 update and so on. using a lisp means redraw every time. I am not a wiz on constraints some one may post a example for you close to what you wnat. Quote
neophoible Posted May 20, 2014 Posted May 20, 2014 BIGAL is right that dynamic blocks or using constraints could work for you and that if using LISP, you will basically erase and redraw or have reactors. If you want to pursue LISP, I can try to help you with simply drawing the item, but not with reactors. Perhaps someone else would be willing to do that? In any case, you will need to provide all of the information, whether programming or constraining, that is, what combinations of diameters, holes, etc., as well as dimensions in general, including those that don't change. Instead of a pic, you would provide a DWG of the items, with the ranges and combinations. Quote
BIGAL Posted May 21, 2014 Posted May 21, 2014 Here is a constraints example, you can see rad3 controls hole diameter the other dia are contrlled from the inner rad and the formula can be rad1*5/3 Quote
neophoible Posted May 21, 2014 Posted May 21, 2014 [ATTACH]49019[/ATTACH]You need something like this?I'm still in release 2012, so I can't open that file. You would need to save it back to the 2010 format for me to be able to take a look. Quote
BIGAL Posted May 22, 2014 Posted May 22, 2014 Just look at the image dont need dwg, you can see the rules as created using constraints like the hole radius is equal to one hole change that all the others change. Quote
neophoible Posted May 22, 2014 Posted May 22, 2014 Just look at the image dont need dwg, you can see the rules as created using constraints like the hole radius is equal to one hole change that all the others change.How did you account for the number of holes needed? Also, he will want a side view. I don't know that anyone is going to be willing to do this for him for free, at least, to the extent he's asking. Quote
N73dp Posted May 22, 2014 Author Posted May 22, 2014 How did you account for the number of holes needed? Also, he will want a side view. I don't know that anyone is going to be willing to do this for him for free, at least, to the extent he's asking. Lisp10.dwgTry this Quote
neophoible Posted May 29, 2014 Posted May 29, 2014 I took a look at the drawing you uploaded, but I do not understand what you really want. My comment about wanting a side view was referring to you, that is, you would want both a top and side view, actually sectional view, not just a top view. It might not be that hard to step you through it, if you really want to learn this. What I can help with is basic AutoLISP, no reactors. If you need a LISP routine that can draw the object based on user input, I can help with that. But you will need to state what the possible combinations are, using a table of values. For example, if the outer radius is between 100 and 120, there will be 4 holes and they will be R5. Tabulate all such information so that it is clear what your program needs to do. If you need to create a drawing that updates itself when you change the geometry, then I do not know how to help you there, using LISP. The dynamic block route may work for you in that case. If you just need to draw one drawing with fixed dimensions using LISP, that is possible, but doesn't sound like something that needs programming. The drawing you submitted suggests that is all you need. If it isn't, then you need to share the rest of the information. Quote
BIGAL Posted May 30, 2014 Posted May 30, 2014 N73dp did you try search here for flange ? Also google "flange lisp" I am a bit suprised a dynamic block has not been uploaded to at least do the plan view as an example, I dont do much mechanical stuff or I am sure I would have a 4 hole flange just sitting there. Quote
N73dp Posted May 30, 2014 Author Posted May 30, 2014 I did it already...It's working how i need. (setq K_radius(getreal "Радиус крышки") K_circle_count(getint "Колличество отверстий")) (setq K_center (list 3200 4100)) (setq K_radius_inLL (- K_radius (* K_radius (/ 3.0 5.0)))) (setq K_radius_inL (- K_radius (* K_radius (/ 4.0 5.0)))) (setq K_radius_inF (/ K_radius (/ 5.0 7.0))) (setq K_radius_inS (- K_radius_inF (- K_radius K_radius_inF))) (setq K_rad_in_dist (- K_radius_inS K_radius_inF)) (setq K_circl_in_x (nth 0 K_center)) (setq K_circl_in_y (+ (nth 1 K_center) (- K_radius_inS (/ K_rad_in_dist 2.0)))) (setq K_circl_point (list K_circl_in_x K_circl_in_y)) (setq K_circl_rad (- (/ K_rad_in_dist 2.0) (/ K_radius_inS 20.0))) (setq K_up_h (/ K_radius 4.0)) (setq dist_test (/ K_rad_in_dist 2.0)) (setq K_otv_r (+ dist_test K_circl_rad)) (setq K_otv_l (- dist_test K_circl_rad)) (setq K_circl_mass_point (list K_circl_in_x (+ K_circl_in_y K_circl_rad))) (setq K_circl_inL_x (nth 0 K_center)) (setq K_circl_inL_y (+ (nth 1 K_center) K_radius_inL)) (setq K_circl_inLL_x (nth 0 K_center)) (setq K_circl_inLL_y (+ (nth 1 K_center) K_radius_inLL)) (setq K_circl_inL_point (list K_circl_inL_x K_circl_inL_y)) (setq K_circl_inLL_point (list K_circl_inLL_x K_circl_inLL_y)) (command "ТИПЛИН" "У" "ПоСлою" "") (command "КРУГ" K_circl_point K_circl_rad) (command "МАССИВКРУГ" "П" "" K_center "О" K_circle_count "" "Ы") (command "КРУГ" K_center K_radius_inL) (command "КРУГ" K_center K_radius_inLL) (command "ТИПЛИН" "У" "ACAD_ISO03W100" "") (command "КРУГ" K_center K_radius) (command "ТИПЛИН" "У" "ПоСлою" "") (command "КРУГ" K_center K_radius_inF) (command "КРУГ" K_center K_radius_inS) (command "ШТРИХ" "SOLID" K_circl_inL_point K_circl_inLL_point "") (setq Point_up_side_center (list (nth 0 K_center)(+ (nth 1 K_center)(* 1.5 K_radius_inS)))) (setq Point_2_up_side_right (list (+(nth 0 Point_up_side_center) K_radius_inS)(nth 1 Point_up_side_center))) (command "ОТРЕЗОК" Point_up_side_center Point_2_up_side_right "") (setq Point_3_up_side_right_up (list (nth 0 Point_2_up_side_right)(+ K_up_h (nth 1 Point_2_up_side_right)))) (command "ОТРЕЗОК" Point_2_up_side_right Point_3_up_side_right_up "") (setq Point_4_up_side_r_u_l (list (- (nth 0 Point_3_up_side_right_up) (- K_radius_inS K_radius_inF))(nth 1 Point_3_up_side_right_up))) (command "ОТРЕЗОК" Point_3_up_side_right_up Point_4_up_side_r_u_l "") (setq Point_5_up_center_up (list (nth 0 Point_4_up_side_r_u_l)(+ (nth 1 Point_4_up_side_r_u_l) K_up_h))) (command "ОТРЕЗОК" Point_4_up_side_r_u_l Point_5_up_center_up "") (setq Point_6_up_up_center (list (nth 0 Point_up_side_center)(nth 1 Point_5_up_center_up))) (command "ОТРЕЗОК" Point_5_up_center_up Point_6_up_up_center "") (setq Point_7_up_up_left (list (- (nth 0 Point_6_up_up_center) K_radius_inF)(nth 1 Point_6_up_up_center))) (command "ОТРЕЗОК" Point_6_up_up_center Point_7_up_up_left "") (setq Point_8_up_left_down (list (nth 0 Point_7_up_up_left)(- (nth 1 Point_7_up_up_left) K_up_h))) (command "ОТРЕЗОК" Point_7_up_up_left Point_8_up_left_down "") (setq Point_9_up_left_left (list (- (nth 0 Point_8_up_left_down) (- K_radius_inS K_radius_inF))(nth 1 Point_8_up_left_down))) (command "ОТРЕЗОК" Point_8_up_left_down Point_9_up_left_left "") (setq Point_10_up_left_down (list (nth 0 Point_9_up_left_left)(-(nth 1 Point_9_up_left_left) K_up_h))) (command "ОТРЕЗОК" Point_9_up_left_left Point_10_up_left_down "") (setq Point_11_up_left_down_center (list (+ (nth 0 Point_10_up_left_down) (- K_radius_inS K_radius))(nth 1 Point_10_up_left_down))) (command "ОТРЕЗОК" Point_10_up_left_down Point_11_up_left_down_center "") (setq Point_12_up_center_center_left (list (nth 0 Point_11_up_left_down_center)(+ (nth 1 Point_11_up_left_down_center) K_up_h))) (command "ОТРЕЗОК" Point_11_up_left_down_center Point_12_up_center_center_left "") (setq Point_13_center_center_center (list (+ (nth 0 Point_12_up_center_center_left) K_radius)(nth 1 Point_12_up_center_center_left))) (command "ОТРЕЗОК" Point_12_up_center_center_left Point_13_center_center_center "") (command "ОТРЕЗОК" Point_13_center_center_center Point_4_up_side_r_u_l "") (command "ОТРЕЗОК" Point_6_up_up_center Point_up_side_center "") (setq K_faska_1_d (list (nth 0 Point_5_up_center_up)(- (nth 1 Point_5_up_center_up) (* 0.5 (* 0.5 K_up_h))))) (setq K_faska_1_l (list (- (nth 0 Point_5_up_center_up) (* 0.5 (* 0.5 K_up_h))) (nth 1 Point_5_up_center_up))) (setq K_faska_2_ur (list (+ (nth 0 Point_7_up_up_left) (* 0.5 (* 0.5 K_up_h))) (nth 1 Point_7_up_up_left))) (setq K_faska_2_ud (list (nth 0 Point_7_up_up_left) (- (nth 1 Point_7_up_up_left) (* 0.5 (* 0.5 K_up_h))))) (setq K_faska_3_dr (list (+ (nth 0 Point_12_up_center_center_left) (* 0.5 (* 0.5 K_up_h)))(nth 1 Point_12_up_center_center_left))) (setq K_faska_3_dd (list (nth 0 Point_12_up_center_center_left) (- (nth 1 Point_12_up_center_center_left) (* 0.5 (* 0.5 K_up_h))))) (setq Point_otv_ur (list (+ (nth 0 Point_9_up_left_left) K_otv_r) (+ (nth 1 Point_up_side_center) K_up_h))) (setq Point_otv_dr (list (+ (nth 0 Point_9_up_left_left) K_otv_r) (nth 1 Point_up_side_center))) (setq Point_otv_ul (list (- (nth 0 Point_otv_ur) (* 2.0 K_circl_rad))(nth 1 Point_otv_ur))) (setq Point_otv_dl (list (- (nth 0 Point_otv_dr) (* 2.0 K_circl_rad))(nth 1 Point_otv_dr))) (command "ОТРЕЗОК" Point_otv_ur Point_otv_dr "") (command "ОТРЕЗОК" Point_otv_ul Point_otv_dl "") (command "ТИПЛИН" "У" "ACAD_ISO03W100" "") (command "ОТРЕЗОК" Point_up_side_center Point_11_up_left_down_center "") (command "ТИПЛИН" "У" "ПоСлою" "") (setq point_shtrih_1 (list (+ (nth 0 Point_9_up_left_left) 2)(- (nth 1 Point_9_up_left_left) 2))) (command "ШТРИХ" "SOLID" K_circl_inL_point K_circl_inLL_point "") (command "СОПРЯЖЕНИЕ" "Д" (* 0.5 K_up_h)) (command "СОПРЯЖЕНИЕ" K_faska_1_d K_faska_1_l) (command "СОПРЯЖЕНИЕ" K_faska_2_ur K_faska_2_ud) (command "СОПРЯЖЕНИЕ" K_faska_3_dr K_faska_3_dd) (command "ТИПЛИН" "У" "ACAD_ISO03W100" "") (setq k_line (list(nth 0 Point_up_side_center) (- (nth 1 Point_up_side_center) (* 0.5 K_up_h)))) (setq k_line2 (list(nth 0 Point_6_up_up_center) (+ (nth 1 Point_6_up_up_center) (* 0.5 K_up_h)))) (command "ОТРЕЗОК" k_line k_line2 "") (setq s_line (list(+ K_circl_rad (nth 0 Point_otv_ul)) (+ (nth 1 Point_otv_ul) (* 0.5 K_up_h)))) (setq s_line2 (list(+ K_circl_rad (nth 0 Point_otv_ul)) (- (nth 1 Point_otv_dl) (* 0.5 K_up_h)))) (command "ОТРЕЗОК" s_line s_line2 "") (command "ТИПЛИН" "У" "ПоСлою" "") (command "_.bhatch" "Свойства" "ANSI31" 0.5 "" Point_12_up_center_center_left "") (setq Point10_1 (list (+ (nth 0 Point_10_up_left_down) 10.0)(+ (nth 1 Point_10_up_left_down) 10.0))) (command "_.bhatch" "Свойства" "ANSI31" 0.5 "" Point10_1 "") Can you help me to do the same with other detail? Quote
BIGAL Posted May 31, 2014 Posted May 31, 2014 You need to look at how the POLAR command works and then its pretty easy to make lines,do the fillet bit last. i would hand draw on a sheet the pt numbers to make the new points so you can see as you code. (setq pt1 (getpoint)) (setq pt2 (polar pt1 100 0)) ; a new pt 100 units away from pt1 at an angle of 0.0 (command "line" pt1 pt2) a couple of suggestions (/ 3.0 5.0) just do the calculator 0.6 answer When doing angles in polar and they are sq make some variables note Pi is a reserved variable ; put at start of code (setq A90 (/ Pi 2.0)) (setq A180 pi) (setq a270 (* pi 1.5)) (setq pt2 (polar pt1 100.0 A90)) Quote
N73dp Posted May 31, 2014 Author Posted May 31, 2014 hm,i will try but i think it useless with my next part Can you give more advices about it? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.