Jump to content

Recommended Posts

Posted

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.

Posted

 
(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)

Posted

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??

2010-12-09202416.png

Posted

ok..... :?,

 

Is it just my eyes or there is no picture?

Posted

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?

Posted

I attach a file here.

the white part are two object.I want to draw the yellow part .see the attachment, please.curve.dwg

Posted

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)

Posted

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

Posted

(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

Posted

@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.

Posted
(vlax-invoke  'IntersectWith  acExtendBoth)

will return a list of points instead of a variant.

Posted

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.

Posted
(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 :)

  • 1 month later...
Posted

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)

)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...