Jump to content

Recommended Posts

Posted

Merry Christmas and a happy new year.

Wishing you and yours a merry Christmas this holiday season. :thumbsup:

 

I want drawing a point on 3d solid.

step.

1. pick a face of 3d solid (point on this face)

2. pick a reference edge and enter the distance value.

3. pick another reference edge and enter the distance value.

4. draw a point (PDMODE=3 PDSIZE=3.0000)

sshot-1.png

sshot-2.png

Posted

maybe can use "copy edges" ,After the drawing point complete, delete this edge ?

Posted (edited)
maybe can use "copy edges" ,After the drawing point complete, delete this edge ?

Hi AIberto,

 

using your idea, but untested (don't have AutoCAD at the moment) and just a starting point

(vl-load-com)
(defun c:demo (/ mk_pt base d1 d2 ent_1 ent_1_lst ent_2 ent_2_lst l_ent p1a p1b p2a p2b pt1 pt2)

(defun mk_pt (ent_1 ent_2 d1 d2 base pt1 pt2 / pt)
 (command "_.ucs" "_NONE" (trans base 0 1) "_NONE" (trans pt1 0 1) "_NONE" (trans pt2 0 1))
 (command "_.offset" d1 ent_1 (trans pt2 0 1) "")
 (entdel ent_1)
 (setq ent_1 (entlast))
 (command "_.offset" d2 ent_2 (trans pt1 0 1) "")
 (entdel ent_2)
 (setq ent_2 (entlast))
 (if (setq pt (vlax-invoke
                (vlax-ename->vla-object ent_1)
                'IntersectWith
                (vlax-ename->vla-object ent_2)
                acExtendBoth
              )
     )
   (command "_.point" "_NONE" (trans pt 0 1))
   (prompt "\nThere is no point at provided data...")
 )
 (entdel ent_1)
 (entdel ent_2)
 (command "_.ucs" "_P")
)

 (setq l_ent (entlast))
 (prompt "\nSelect first edge: \n")
 (command "_.solidedit" "_edge" "_copy" "\\" "" "0,0,0" "0,0,0" "_X" "_X")
 (setq ent_1 (entlast))
 (if (and (not (eq l_ent ent_1))
          (setq d1 (getdist "\nEnter offset distance: "))
     )
   (progn
     (prompt "\nSelect second edge: \n")
     (command "_.solidedit" "_edge" "_copy" "\\" "" "0,0,0" "0,0,0" "_X" "_X")
     (setq ent_2 (entlast))
     (if (and (not (eq ent_2 ent_1))
              (setq d2 (getdist "\nEnter offset distance: "))
         )
       (progn
         (setq ent_1_lst (entget ent_1)
               p1a       (trans (cdr (assoc 10 ent_1_lst)) 1 0)
               p1b       (trans (cdr (assoc 11 ent_1_lst)) 1 0)
               ent_2_lst (entget ent_2)
               p2a       (trans (cdr (assoc 10 ent_2_lst)) 1 0)
               p2b       (trans (cdr (assoc 11 ent_2_lst)) 1 0)
         )
         (cond ((equal p1a p2a 1e-6)
                (setq base p1a
                      pt1  p1b
                      pt2  p2b
                )
                (mk_pt ent_1 ent_2 d1 d2 base pt1 pt2)
               )
               ((equal p1a p2b 1e-6)
                (setq base p1a
                      pt1  p1b
                      pt2  p2a
                )
                (mk_pt ent_1 ent_2 d1 d2 base pt1 pt2)
               )
               ((equal p1b p2a 1e-6)
                (setq base p1b
                      pt1  p1a
                      pt2  p2b
                )
                (mk_pt ent_1 ent_2 d1 d2 base pt1 pt2)
               )
               ((equal p1b p2b 1e-6)
                (setq base p1b
                      pt1  p1a
                      pt2  p2a
                )
                (mk_pt ent_1 ent_2 d1 d2 base pt1 pt2)
               )
               (T
                (entdel ent_1)
                (entdel ent_2)
                (prompt "\nSelected edges don't have a common point...")
               )
         )
       )
     )
   )
 )
 (princ)
)

I hope this helps

Henrique

Edited by hmsilva
Fix code
Posted
Hi AIberto,

 

using your idea, but untested (don't have AutoCAD at the moment) and just a starting point

 

I hope this helps

Henrique

 

Hi henrique .

 

Thanks so much! nice routine !

There is a small problem.

I enter the distance value is "15" , But the actual value is wrong.

sshot-1.png

Posted

Hi AIberto,

 

the code in post #3 should work as expected, code was revised, but not tested...

 

Henrique

Posted
Hi AIberto,

 

the code in post #3 should work as expected, code was revised, but not tested...

 

Henrique

 

Thanks Henrique , now, the distance value is right.

 

"There is no point at provided data..." How about this mean ?

Posted
Thanks Henrique , now, the distance value is right.

"There is no point at provided data..." How about this mean ?

You're welcome, AIberto.

 

The "There is no point at provided data..." it's a message to display if user select parallels edges, in this case the intersection will be impossible...

 

Henrique

Posted
You're welcome, AIberto.

 

The "There is no point at provided data..." it's a message to display if user select parallels edges, in this case the intersection will be impossible...

 

Henrique

 

if select parallels edges will be display "Selected edges don't have a common point.." , not display "There is no point at provided data..."

Posted
if select parallels edges will be display "Selected edges don't have a common point.." , not display "There is no point at provided data..."

 

You are correct, that msg is the return from the test 'cond' if there is no common point from the two edges.

The another msg is from the 'mk_pt' function to throw if there is no return from the 'IntersectWith' function.

 

Henrique

Posted
You are correct, that msg is the return from the test 'cond' if there is no common point from the two edges.

The another msg is from the 'mk_pt' function to throw if there is no return from the 'IntersectWith' function.

 

Henrique

 

Thanks ! Henrique. Good explanation:)

Posted

You're welcome, AIberto

Glad I could help

 

 

Henrique

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