johnsonrod Posted February 26, 2014 Share Posted February 26, 2014 I'm trying to join an arc and a line. I've tried the following: (setq arc1 (entmakex-arc cen rad ang1 ang2 lyr)) (setq pt1 (vlax-curve-getStartPoint arc1)) (setq pt2 (vlax-curve-getEndPoint arc1)) (setq lin1 (entmakex-line pt1 pt2 lyr)) (vl-cmdf "._join" arc1 lin1) 'entmakex-arc' and 'entmakex-line' are functions to make the respective entities (params should be self-explanatory). This code draws the arc and the line properly but will not perform the join. I've searched the internet for an hour now, and cannot find anything that works. What is wrong with this code? Or, if there's a better way to approach this task, please tell. I've tried variations adding an empty string "" to the end of the vl-cmdf parameters, but nothing works. Note that the entities are drawn in AutoCAD and I can manually join them together, so the endpoints match up, etc. But, I need to automate the join part. Any help is appreciated. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 26, 2014 Share Posted February 26, 2014 Some food ... http://www.cadtutor.net/forum/showthread.php?84221-Lisp-to-Select-Picking-line-arc-spline-to-Create-Polyline&p=576903&viewfull=1#post576903 Quote Link to comment Share on other sites More sharing options...
GP_ Posted February 26, 2014 Share Posted February 26, 2014 Another. (vl-cmdf "._pedit" lin1 (if (eq (getvar 'peditaccept) 0) "_Y") "" ) (vl-cmdf "._join" (entlast) arc1 "") or (vl-cmdf "._pedit" lin1 (if (eq (getvar 'peditaccept) 0) "_Y") "_J" arc1 "" "") Quote Link to comment Share on other sites More sharing options...
David Bethel Posted February 26, 2014 Share Posted February 26, 2014 If it is always a single arc with the endpoints connected, why not just (entmake) the LWPOLYINE ? -David Quote Link to comment Share on other sites More sharing options...
johnsonrod Posted February 26, 2014 Author Share Posted February 26, 2014 Yes, it's always a single arc with line connecting the endpoints. This sounds like a great idea, and almost certainly more efficient than the way I'm approaching it now. I've only done really basic stuff with entmake and entmakex. Could you provide a few lines of example code for this? Thanks. Quote Link to comment Share on other sites More sharing options...
johnsonrod Posted February 26, 2014 Author Share Posted February 26, 2014 @Tharwat and GP_ I've used a combination of your posts, and almost have a working function. It's joining the first arc/line combo, but still crapping out on me after that. I need to review other parts of the code and sort of clean house to find the issue. Probably tomorrow. Thanks for the input. Quote Link to comment Share on other sites More sharing options...
johnsonrod Posted February 27, 2014 Author Share Posted February 27, 2014 If it is always a single arc with the endpoints connected, why not just (entmake) the LWPOLYINE ? -David I was looking around for some example code for creating a polyline and found: http://www.theswamp.org/index.php?topic=9728.0 http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/lwpolyline-with-entmake/td-p/2421606 These use a list of points to create the polyline, which is feasible, but is there any way to do it using an arc? I know I could approximate the arc by picking off a few points from the arc, but is there an exact way? Quote Link to comment Share on other sites More sharing options...
johnsonrod Posted February 27, 2014 Author Share Posted February 27, 2014 If it is always a single arc with the endpoints connected, why not just (entmake) the LWPOLYINE ? -David I ended up going to with this option and it worked. It was close enough to what I needed, and worked first time (with code from http://www.theswamp.org/index.php?topic=9728.0). Thanks for the idea. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted February 27, 2014 Share Posted February 27, 2014 Glad you got it to work. I was trying to come up with absolute minimum code to use with entmake. -David Quote Link to comment Share on other sites More sharing options...
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.