Daniele Posted December 6, 2010 Posted December 6, 2010 (edited) Hello I've a problem with Autocad 2011 and parametric design. I want to use a Reference parameter in a costraint's expression. For example, I'm drawing a simple triangle, where A, B, C are sides and alpha, beta, gamma are angles. I can fix the lenght of A and C and the value of alpha (which is the angle between them), so I have a completely constrained triangle. Now, I want to use the value of beta and gamma (which I didn't constrain) in the expression of another object. I tried to assign a Reference Parameter to beta and gamma, but I can't use them in any expression because The operation would result in reference constraint in an expression. Reference constraints are driven values; they cannot drive the values of other parameters. So, if I can't use them to drive other paramethers, what can I do with reference parameters? Is there a way to pass an "uncostrained value" as variable in a constraint expression? EDIT: I'm adding a simple draw to explain the case http://dl.dropbox.com/u/12174476/Triangle.dwg Edited December 6, 2010 by Daniele Added an explaining link Quote
BIGAL Posted December 7, 2010 Posted December 7, 2010 a/sina =b/sinb =c/sinc sina sine of angle a you should be able to work out the others you have enough known values. Quote
Daniele Posted December 7, 2010 Author Posted December 7, 2010 a/sina =b/sinb =c/sinc sina sine of angle a you should be able to work out the others you have enough known values. Well, I know, but this was just an example. I've to apply it to geometries which are far more complicated. It's out of the question to find an expression for it every time I need to use the value of an unconstrained object. Quote
Grant Posted December 7, 2010 Posted December 7, 2010 Only thing I can think of is to grab the number through lisp Try the Lisp thread Hope this helps Quote
Grant Posted December 8, 2010 Posted December 8, 2010 Type this: (setq ss (ssget)); pick the dimension then (setq ent (entget (ssname ss 0))) You will get: ((-1 . ) (0 . "DIMENSION") (5 . "988") (102 . "{ACAD_REACTORS") (330 . ) (102 . "}") (330 . name: 7ffff7749f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "*ADSK_CONSTRAINTS") (100 . "AcDbDimension") (280 . 0) (10 216.364 100.46 0.0) (11 216.364 100.46 0.0) (12 0.0 0.0 0.0) (70 . 129) (1 . "(d3=99.6021)") (71 . 5) (72 . 1) (41 . 1.0) (42 . 99.6021) (73 . 0) (74 . 0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0 1.0) (3 . "STD") (100 . "AcDbAlignedDimension") (13 141.543 127.632 0.0) (14 201.705 48.2524 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 . 0.0)) 42 = the size 1 = (d3= 'the size') Quote
Daniele Posted December 8, 2010 Author Posted December 8, 2010 Type this:(setq ss (ssget)); pick the dimension then (setq ent (entget (ssname ss 0))) You will get: ((-1 . ) (0 . "DIMENSION") (5 . "988") (102 . "{ACAD_REACTORS") (330 . ) (102 . "}") (330 . name: 7ffff7749f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "*ADSK_CONSTRAINTS") (100 . "AcDbDimension") (280 . 0) (10 216.364 100.46 0.0) (11 216.364 100.46 0.0) (12 0.0 0.0 0.0) (70 . 129) (1 . "(d3=99.6021)") (71 . 5) (72 . 1) (41 . 1.0) (42 . 99.6021) (73 . 0) (74 . 0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0 1.0) (3 . "STD") (100 . "AcDbAlignedDimension") (13 141.543 127.632 0.0) (14 201.705 48.2524 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 . 0.0)) 42 = the size 1 = (d3= 'the size') Ok... I think LISP it's the kind of feature which requirest a little bit of training, specially for a total beginner like me. I'll try your code and I'll read something around... Thank you. Quote
BIGAL Posted December 9, 2010 Posted December 9, 2010 Had a look at your dwg and my first post is still correct for a triangle Its been a long time since I played with parametric's but you should be able to say lengtha legthb ang1 new line length = sin length+100 Check out the Autocad help a bit more just had a look at "Dimensional constraint" it shows d1 d2 d3 d4 etc I am pretty sure you could add the sin(a) for d5 You may be able to save your constaints so the traingle solution is the first one in a collection. Quote
BIGAL Posted December 9, 2010 Posted December 9, 2010 (edited) Had a play got all sorts of answers to work d1=A+B+250*sin(alpha) it doesn't like mixing dimensional constraints and refernce paremeters got it to work erased line ? drew line again and did as aligned dim only problem is it will not let me change the length of the line wich I should be able to do its to do with the locking need to constrain but not lock. Bit more drew 2 lines at angles drew 1 line used parametric "dim aligned" picked ends of angle lines used "dim aligned" picked start and end of single line, double click text d1=123.4567 and made it d1=d2+100 which is what you want auto grows auto. What you want is enter angle and length of sides draw new answer and use 3rd side You need the 3rd constraint not locked but to reflect an answer then problem solved need a equivalent to distance between two points via a constraint Edited December 9, 2010 by BIGAL Quote
BIGAL Posted December 9, 2010 Posted December 9, 2010 3rd try yes it can be done but a bit more playing you need a triangle with two angles as parametrics and two kown sides as parametric create a use parameter unknownside =A/sin(a)*Sin(b) this equals unknown side length draw a line Parameter the line and make its value =unknownside+100 change angle or lengths all works because the unknown is calculated not measured and locked. bottom line someone out there know how we can add a expression angle diff between two lines but not as a constraint ? Quote
Daniele Posted December 9, 2010 Author Posted December 9, 2010 What you want is enter angle and length of sides draw new answer and use 3rd side Generally speaking, I want to use a reference parameter as a variable in a constraints expression without having to find any math expression for it. Obviously it's always possible to find an expression for a reference parameter, since it is a function of the constraints, but I just don't need it. Actually, I "solved" the problem in this way: http://dl.dropbox.com/u/12174476/MAM/Esercitazione%204/Fairbairn.dwg The grey vertical lines on the left has the same lenght of the reference parameter I want to use. Everytime I change the position of the white linkage (by changing fi2), the grey line change it's lenght. So, I'm just copying the value of that lenght into the constraint applied on the green line, and then I'm using that constraint as "variable" in other constraint's expression. So, I have to use a contraint which is the copy of a reference parameter, and I have to copy it by hand, instead of just using the value of the reference parameter. LISP could probably be a solution, but actually I'll spend more time learning how to do than doing it by hand. Quote
BIGAL Posted December 10, 2010 Posted December 10, 2010 (edited) Actually for a triangle in lisp its easy just pick the 3 points that make the triangle this gives ang1 dist1 ang2 dist2 and dist3 then just pick a point for the start of your new line pick a brg angle and your line will appear. (setq pt1 (getpoint "\nPick 1st pt")) (setq pt2 (getpoint "\nPick 2nd pt")) (setq pt3 (getpoint "\nPick 3rd pt")) ; you can get angels and distances (setq ang1 (angle pt1 pt2)) (setq dist3 (distance pt1 pt3)) (setq newlen (+ dist3 100.0)) (setq pt4 (getpoint "\npick line start pt")) (setq pt5 (getpoint pt4 "\npick line end pt")) (setq ang4 (angle pt4 pt5)) (setq pt6 (polar pt4 ang4 newlen)) (command "line" pt4 pt6 "") ; all done this took about 5 minutes I spent about an hour yesterday trying to figure it out wit parametrics. You can still use your parametric triangle Edited December 13, 2010 by BIGAL 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.