3d Solid Align

3d Solid Align

jyan2000
Advocate Advocate
1,321 Views
9 Replies
Message 1 of 10

3d Solid Align

jyan2000
Advocate
Advocate

Hello everyone,

 

Is there any lisp can align ( 3 point alignment  ) a single 3d Solid object to x,y,z ( 0,0,0 ) origin ? I've been seeking for this LISP for months yet not able to find any solution.

 

Best regards

 

Victor. 

0 Likes
1,322 Views
9 Replies
Replies (9)
Message 2 of 10

hmsilva
Mentor
Mentor

Hi Victor,

something like this perhaps...

 

(defun c:demo (/ p1 p2 p3 ss)
  (cond ((and (princ "\nSelect a 3DSolid to align to WCS: ")
              (setq ss (ssget "_+.:E:S:L" '((0 . "3DSOLID"))))
              (setq p1 (getpoint "\nSelect 3DSolid point to align to origin: "))
              (setq p2 (getpoint "\nSelect 3DSolid point to align to XAxis: "))
              (setq p3 (getpoint "\nSelect 3DSolid point to align to YAxis: "))
         )
         (command "_.align" ss "" "_NON" p1 "_NON" '(0. 0. 0.) "_NON" p2 "_NON" '(1. 0. 0.) "_NON" p3 "_NON" '(0. 1. 0.))
        )
  )
  (princ)
)

 

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 10

Anonymous
Not applicable

Try this:

 

;************************************ AALIGN.LSP **************************************
;AUTOLISP ROUTINE TO AUTOMATE ALIGNMENT PROCESS

(DEFUN C:AALIGN ()

;; check and load "align" arx command
  
 (if (not align) (arxload "geom3d" T))
 
 (SETQ SS1 (SSGET))
 (SETQ PT1 (GETPOINT "\nPick 1st Source Point (0,0)")
       PT2 (GETPOINT "\nPick 2nd Source Point (1,0)")
       PT3 (GETPOINT "\nPick 3rd Source Point (0,1)")
       D1 (LIST 0.0 0.0 0.0)
       D2 (LIST 1.0 0.0 0.0)
       D3 (LIST 0.0 1.0 0.0)
 )

 (ALIGN SS1 PT1 D1 PT2 D2 PT3 D3)

(PRINC)

)
0 Likes
Message 4 of 10

Anonymous
Not applicable

Looks like @hmsilva beat me to it while I was tidying up my code.

0 Likes
Message 5 of 10

jyan2000
Advocate
Advocate

Hello Patrick Hughes, 

 

This code looks pretty good. 1st code was fine too but was specific for 3d object only. I would prefer second code, however, Is there any way of ALIGN'ing object/s without picking points / vertexes ( such as  p1 to x,y,z ( 0,0,0), p2 to x,y,z ( 100,0,0), p3 to x,y,z ( 0,100,0),? Thanx a lot. 

 

 

Best Regards

 Victor

 

0 Likes
Message 6 of 10

devitg
Advisor
Advisor

Which kind of solid . Regular, prismatic,pyramidal, irregular ?-Please show it in a dwg . Which point to be at 0 0 0? Centroid, lower left, upper right ?

0 Likes
Message 7 of 10

jyan2000
Advocate
Advocate

There is the attached file. 

 

regards. 

 

Victor

0 Likes
Message 8 of 10

devitg
Advisor
Advisor

Please enligthme , your 3dsolid is a 0 (zero) volume 3dsolid, seem not to be a real solid,, despite it is a 3dsolid for ACAD.

Which are the pt1, pt2,pt3 point for it.

And last , but not least, WHAT do you want to do. 

For this case a Flatten can put the 3dsolid at 0 z , then it have to rotate to be aligned with XY axis. and move  to 0 0 0

 

0 Likes
Message 9 of 10

jyan2000
Advocate
Advocate

Dear Devitg,

I appreciate your quick respond and  I’m really thankful to you.

This is a diamond shape panel is to be flatten. It’s converted to dwg file from other software and it is not an Acad 3D solid. There are 6000 over type of this diamond shapes to be flatten. FLATTEN command is perfectly flattening the objects. However, size of diamond is shrinking (see Attached file).That’s not we want.

 I’m poor in writing code. That’s the reason asking experts such as you could help me. Basically, what could it be done:

1 – explode 3D solid Objects

2- convert to 3D polyline. ( once we have 4 segment)

3- move / align three  corner  origin (exp: p1 to x,y,z ( 0,0,0), p2 to x,y,z ( 100,0,0), p3 to x,y,z ( 0,100,0)

 Could it be possible to done this ?

Best regards

Victor

0 Likes
Message 10 of 10

devitg
Advisor
Advisor

I´ll see it tomorrow. It is Saturday Night . 

Please contact me at 

 

myusernamehereatgmail.com  

0 Likes