几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 12:08 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】ifthen equation

if/then equation
hello everyone,
i am trying to do what is probably a fairly simple equation, but i am not having much success. i have a piece of formed channel sheet steel, and i have a hole that is patterned in it. i want to put a if/then that has three parameters in it that state if the overall length of the part is 120 or greater, then the pattern distance is 3. if the overall length of the part is 110 to 119, then the pattern distance is 2. and finally, if the overall length of the part is less than 110, then the pattern distance is 1.
does anyone know if this can be done, and if so, what the equation might look like?
aaron
solidworks/pdmworks 08 4.0
cadkey 99 r1.0 (yes, still using it!)

find a job or post a job opening
you can use the iif statement from vba. syntax for iif is:
iif([condition],[value if true],[value if false])
iif statements can be nested.
basically, if your pattern distance is "p" and your overall length is "l" then your equation would be:
p = iif(l>=120,3,iif(l<110,1,2))
-handleman, cswp (the new, easy test)
you can also achieve the same in a design table where the hole pattern quantity has they typical if/then statement out of excel, referencing the length dimension.
jeff mirisola, cswp, certified driveworks ae
handleman,
i tried your suggestion, and i am still doing something wrong. i have uploaded a couple pictures of the equations i did to try and simulate what you did. am i doing something wrong with punctuation perhaps? im addition to using "p" and "l" in the equation, i tried it with the actual dimension names to no avail (pic 3).
aaron
solidworks/pdmworks 08 4.0
cadkey 99 r1.0 (yes, still using it!)

aaron,
create a design table that captures the length and the pattern distance. once created, click on the cell that contains the pattern distance and replace it with this formula:
=if(b2>=120,3,(if(b2<=110,1,2)))
b2 represents the cell that contains the length dimension, so change it accordingly.
jeff mirisola, cswp, certified driveworks ae
jeff,
thank you, it works great! it will only update if i go into the design table though. is there a way to make it update after a rebuild?
aaron
solidworks/pdmworks 08 4.0
cadkey 99 r1.0 (yes, still using it!)

you should be able to hit 'ctrl+q' to get it to rebuild.
jeff mirisola, cswp, certified driveworks ae
that's the downside of a dt, it has to be opened to be updated; an equation doesn't.

here is a sample without a design table. simply change the length and the rest changes as requested. (the ref dimension showed is only to show that it is changing)
that's strange. the = isn't being accepted in the iif portion of the equation.
i think you've discovered a bug.

smcadman,
exactly what i was hoping to do! (except for the 119.999 thingy, but that can be dealt with) thank you sir!
aaron
solidworks/pdmworks 08 4.0
cadkey 99 r1.0 (yes, still using it!)
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】equation question yang686526 SolidWorks二次开发 0 2009-04-13 10:43 AM
【转帖】equation for extrusion depth yang686526 SolidWorks二次开发 0 2009-04-13 10:42 AM
【转帖】open the equation manager of a componen yang686526 SolidWorks二次开发 0 2009-04-12 09:57 PM
【转帖】equation to create 3d curve yang686526 SolidWorks二次开发 0 2009-04-12 08:50 PM


所有的时间均为北京时间。 现在的时间是 02:59 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多