Jump to content

Recommended Posts

Posted

How can i determine y coordinate for a point on a lwpolyline, if i know his x coordinates?

Posted

You just find inters of LWPline with a xline // OY and has same x coord, then delete xline ^^

Posted

Just draw a vertical line on that particular X coordinate and use the intersection functions shared by LeeMac to find the intersection point with your polyline.

 

Regards,

Mircea

Posted
can you show us how did you get his x coordinate ? :D

 

That make no difference; for example he may want to get the elevation on a given profile at a given station.

 

Regards,

Mircea

Posted

I'm trying to do this (intest of a poly with xline), but ...something wrong...

 

(defun c:ii ()
(vl-load-com)
(setq util (vla-get-utility 
                  (vla-get-activedocument 
                       (vlax-get-acad-object))))                        
(vla-getentity util 'obj1 'ip "\nSelect First Object: ")
(vla-getentity util 'obj2 'ip "\nSelect Second Object: ")
(setq int (vla-IntersectWith obj1 obj2 acExtendBoth))
(princ int)
(setq p (vlax-safearray->list
(vlax-variant-value int)))
 
(princ)
);defun

Posted

If will replace with the code from Lee's function, that will return the point:

 

(setq int (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth))

 

Regards,

Mircea

Posted

Check this one now ...

 

(defun c:TesT (/ obj1 obj2 int p)
 (vl-load-com)
 (if (and
       (progn
         (prompt " Select First Object: ")
         (setq obj1 (ssget "_+.:S" '((0 . "*POLYLINE"))))
       )
       (progn
         (prompt " Select Second Object : ")
         (setq obj2 (ssget "_+.:S" '((0 . "*POLYLINE"))))
       )
     )
   (if (and (not (vlax-curve-isclosed (ssname obj1 0)))
            (not (vlax-curve-isclosed (ssname obj2 0)))
       )
     (progn
       (setq int (vla-IntersectWith
                   (vlax-ename->vla-object (ssname obj1 0))
                   (vlax-ename->vla-object (ssname obj2 0))
                   acExtendBoth
                 )
       )
       (princ (setq p (vlax-safearray->list
                        (vlax-variant-value
                          int
                        )
                      )
              )
       )
     )
     (princ "\n One of Polylines is closed ")
   )
   (princ)
 )
 (princ)
)

Posted

Maybe my variable are not ok, but the intersection point is ALWAYS close to the real intersection point...

Posted

 

(defun c:ii ()
...
....

[b][color="red"](princ[/color][/b]   (setq p (vlax-safearray->list
(vlax-variant-value int))))
.....
.....

 

It worked for me ...

Posted

@transcad: I took the liberty to adjust a little your code:

 

(defun c:ii  ()
(vl-load-com)
(setq util (vla-get-utility
            (vla-get-activedocument
             (vlax-get-acad-object))))
(vla-getentity util 'obj1 'ip "\nSelect First Object: ")
(if (and obj1
         (setq xCoord (getpoint "\nPick X ccordinate: ")))
 (progn
  (entmakex
   (list '(0 . "LINE")
         (cons 10 (polar xCoord (* -0.5 pi) 1.0))
         (cons 11 (polar xCoord (* 0.5 pi) 1.0))))
  (setq obj2 (vlax-ename->vla-object (setq tmpEnt (entlast))))
  (setq int (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth))
  (princ int)
  (entdel tmpEnt)
  )
 )
(princ)
)   ;defun

 

Regards,

Mircea

Posted

It's ok guys, thanks! My mistake...

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