blueshake Posted December 9, 2010 Posted December 9, 2010 hi,all I knew that we can use function "inters" to the intersect point. but for the curve (arc spline) and line. how can we get their intersect point.thank you for your time. Quote
pBe Posted December 9, 2010 Posted December 9, 2010 (setq dd (vlax-ename->vla-object (car (entsel))) ss (vlax-ename->vla-object (car (entsel)))) (vlax-safearray->list(vlax-variant-value(vla-intersectwith dd ss acExtendNone))) IntersectWith Method Gets the points where one object intersects another object in the drawing RetVal = object.IntersectWith(IntersectObject, ExtendOption) Quote
blueshake Posted December 9, 2010 Author Posted December 9, 2010 thank you for your reply. but I meet another problem. see the below picture. when I get the intersect point(A) if I want to draw the yellow part. for line.I just to need use "Line" command it can be easily done.but for curve(arc spline),it it quite hard.any idea on this?? Quote
pBe Posted December 9, 2010 Posted December 9, 2010 ok..... , Is it just my eyes or there is no picture? Quote
ccowgill Posted December 9, 2010 Posted December 9, 2010 I see a picture, I dont fully understand the question, but would it not be possible just to turn edgemode on and extend the two objects? or do you want the "extended" portions to be yellow and dashed as opposed to white and solid? Quote
blueshake Posted December 9, 2010 Author Posted December 9, 2010 I attach a file here. the white part are two object.I want to draw the yellow part .see the attachment, please.curve.dwg Quote
blueshake Posted December 9, 2010 Author Posted December 9, 2010 the most complicate part is how to draw the yellow curve(it is extend part of the white object,but I want them are two objects) Quote
ccowgill Posted December 9, 2010 Posted December 9, 2010 yellow curve psuedo code, I'm not sure of the codeing and I'm a fishin' pole kind of guy, but the steps I would take would be: get white arc center point get intersection of white arc and white line get white arc bottom end point or end point nearest the intersection draw arc using center to start then begin point and end point Quote
GP_ Posted December 9, 2010 Posted December 9, 2010 (setq dd (vlax-ename->vla-object (car (entsel))) ss (vlax-ename->vla-object (car (entsel)))) (vlax-safearray->list(vlax-variant-value(vla-intersectwith dd ss [b]acExtendBoth[/b]))) exextendoption: to have it find either only actual intersections, or intersections of extensions of the object(s). From the ActiveX/VBA Reference: acExtendNone - Does not extend either object. acExtendThisEntity - Extends the base object. acExtendOtherEntity - Extends the object passed as an argument. acExtendBoth - Extends both objects Quote
blueshake Posted December 9, 2010 Author Posted December 9, 2010 @ccowgill first thank you for your help. arc is just one sample for curve.it(curve) maybe can be spline or something else. expect someone can solve this. Quote
alanjt Posted December 9, 2010 Posted December 9, 2010 (vlax-invoke 'IntersectWith acExtendBoth) will return a list of points instead of a variant. Quote
ccowgill Posted December 9, 2010 Posted December 9, 2010 In my simplistic way of looking at it, you could copy the object, extend it to the intersection, then trim the new "copied" object back at the original end point of the original object. but I'm sure the VLISP methods will be much more efficient. Quote
pBe Posted December 10, 2010 Posted December 10, 2010 (vlax-invoke <Object1> 'IntersectWith <Object2> acExtendBoth) will return a list of points instead of a variant. I almost always overlook the use of "vla-invoke".... Good point Alanjt Quote
blueshake Posted January 10, 2011 Author Posted January 10, 2011 today I write the following codes to do the job I mentioned above. I use (vlax-invoke <Object1> 'IntersectWith <Object2> acExtendBoth) to get the insect point.but one issue comes out.if the objects have two intersected points. it is hard to judge which one is the point I want.any idea on this?? thanks. (setq insecpoint (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth)) contain array which has six elements (for two points). (defun c:cornor_of_obj(/ os_old cl_old sel1 sel2 ent1 ent2 entiny1 entiny2 enttype1 enttype2 obj1 obj2 p1 p2 p3 p4 pt centerpt insecpoint) (vl-load-com) (defun *error* (msg) (setvar "cmdecho" os_old) (setvar "clayer" cl_old) (princ) ) (if (not (tblsearch "layer" "0虚线层")) (command "_.layer" "_new" "0虚线层" "_color" "2" "0虚线层" "_ltype" "DASHED" "0虚线层" "") (command "_.layer" "thaw" "0虚线层" "on" "0虚线层" "unlock" "0虚线层" "") ) (setq os_old (getvar "cmdecho")) (setq cl_old (getvar "clayer")) (setvar "clayer" "0虚线层") (setvar "cmdecho" 0) (setq sel1 (entsel "choose the objects :")) (setq ent1 (car sel1)) (if (/= nil ent1) (progn (setq entiny1 (entget ent1) enttype1 (assoc 0 entiny1) ) (if (or (= "LINE" (cdr enttype1)) (= "ARC" (cdr enttype1))) (progn (setq obj1 (vlax-ename->vla-object ent1)) (setq p1 (vlax-safearray->list (vlax-variant-value (vla-get-startpoint obj1))) p2 (vlax-safearray->list (vlax-variant-value (vla-get-endpoint obj1))) ) (setq sel2 (entsel "choose the objects :")) (setq ent2 (car sel2)) (if (/= nil ent2) (progn (setq entiny2 (entget ent2) enttype2 (assoc 0 entiny2) ) (if (or (= "LINE" (cdr enttype2)) (= "ARC" (cdr enttype2))) (progn (setq obj2 (vlax-ename->vla-object ent2)) (setq p3 (vlax-safearray->list (vlax-variant-value (vla-get-startpoint obj2))) p4 (vlax-safearray->list (vlax-variant-value (vla-get-endpoint obj2))) ) ;(setq insecpoint (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth)) (setq insecpoint (vlax-safearray->list(vlax-variant-value(vla-intersectwith obj1 obj2 acExtendBoth)))) (if (/= nil insecpoint) (progn (setq d1 (distance insecpoint p1)) (setq d2 (distance insecpoint p2)) (if ( (setq pt p1) (setq pt p2) ) ;line 1 (cond ((= "LINE" enttype1) (command "_.Line" insecpoint pt "") ) ((= "ARC" enttype1) (setq centerpt (vlax-safearray->list (vlax-variant-value (vla-get-center ent1)))) (command "_.arc" "_c" centerpt insecpoint pt) ) ) (if ( (setq pt p3) (setq pt p4) ) ;line 2 (cond ((= "LINE" enttype2) (command "_.Line" insecpoint pt "") ) ((= "ARC" enttype2) (setq centerpt (vlax-safearray->list (vlax-variant-value (vla-get-center ent1)))) (command "_.arc" "_c" centerpt insecpoint pt) ) ) ) ) ) ) ) ) ) ) ) ) (setvar "cmdecho" os_old) (setvar "clayer" cl_old) (princ) ) 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.