Jump to content

projecting geometry


boyo

Recommended Posts

I want to transfer geometry of a rectangle onto another plane. Is there a command to accomplish it. The plane I want to transfer the rectangle onto is at 40deg angle to the plane rectangle is currently on.

Link to comment
Share on other sites

Is it something like this you wish to accomplish?

ill need to affirm before I give out the solution, maybe you got something else in mind :wink:

00.jpg

Link to comment
Share on other sites

I want to transfer geometry of a rectangle onto another plane. Is there a command to accomplish it. The plane I want to transfer the rectangle onto is at 40deg angle to the plane rectangle is currently on.

 

Try ROTATE3D.

Link to comment
Share on other sites

It's a fairly straightforward trigonometry problem to calculate the length of the projected rectangle. But if you want a graphical solution, you need to construct perpendiculars to the base rectangle that pass through the angle plane. Then you need to find the intersection points in the angle plane. In Autocad, I think the angle plane must be perpendicular to the XY plane of the WCS (the plan view) and you must be looking at the plan view in order to use the Apparent Intersection object snap. When you have the snap points, you draw lines in the Z axis to define the edges of the projected rectangle. I hope this makes sense. If you're doing this kind of thing frequently, you may benefit from a lisp that finds the shortest distance between skew lines which, in effect, finds apparent intersections in any UCS. If this is of interest to you, let me know and I'll post the code.

proj_example.jpg

Link to comment
Share on other sites

By all means Calcad if you have the code I would have it. I tried different approaches with osnapz set to 1 before I realized all computer can do is to throw an exact image along z axis with automatic rotation, which is basically a copy. The copy ends up on the right plane though someplace I don’t want to. It does restrict snaps to active UCS which can be useful when plane angle is the same between original and copy which is not the case in this particular example.

The best I could do was to revert osnapz to default 0 and cross the target plane with 2 temporary rectangles snapped off from the original. Then use apparent intersection to draw the projection snapping in side view and continuing in 3d.Obviously with very complicated shapes it would be impossible.

Link to comment
Share on other sites

OK, here it is. Try drawing some skewed lines in 3D to see how it works. The important thing about this program in connection with projected images is that the shortest line between skewed lines is perpendicular to both lines.

 

 

 

; LSQ.LSP - "LINE SKEW" Connects SKEW lines with the shortest connector
;               From original code (c)1992, Mitchell A. Wawzonek
;   Mitchell A. Wawzonek, P.Eng., Professor
;   School of Engineering Technology
;   Conestoga College
;   299 Doon Valley Drive
;   Kitchener, ON   N2G 4M4
;   Canada
;
;   FINDS THE COMMON PERPENDICULAR 
;   BETWEEN 2 SKEW LINES
;
; 5-26-06  Added error handling and useability in any UCS.
;          Also declared local variables.
;
(defun lsq_error (msg)
(setq *error* sys_error)
(command "UCS" "R" "SYSUCS")
(command "UCS" "D" "SYSUCS")
(setvar "OSMODE" OLDSNAP)
(setvar "CMDECHO" 1)
(redraw)
(princ)
)
(defun C:LSQ (/ E1 E2 P1 P2 P3 P4 X1 X2 X3 X4 Y1 Y2 Y3 Y4 
               Z1 Z2 Z3 Z4 A D B C F CA SA ANG R1 R P5 P6 DS )
               
  (setq sys_error *error*)
  (setq *error* lsq_error)
  (setvar "CMDECHO" 0)
  (setq OLDSNAP (getvar "OSMODE"))
  (setvar "OSMODE" 0)
  (command "UCS" "S" "SYSUCS")
  (command "UCS" "")
  (setq E1 nil E2 nil)
     (while (null E1)
        (setq E1 (entsel "\nLine 1:"))
        (if E1
           (progn
              (setq E1 (car E1))
              (redraw E1 3)
              (if (/= (cdr (assoc 0 (entget E1))) "LINE")
                 (progn
                    (prompt "\nEntity is a ")
                    (princ (cdr (assoc 0 (entget E1))))
                    (princ ". Select a LINE")
                    (setq E1 nil)
                  )
               )
            )
        )
     ) ;endwhile
     (while (null E2)
        (setq E2 (entsel "\nLine 2:"))
        (if E2
           (progn
              (setq E2 (car E2))
              (if (/= (cdr (assoc 0 (entget E2))) "LINE")
                 (progn
                    (prompt "\nEntity is a ")
                    (princ (cdr (assoc 0 (entget E2))))
                    (princ ". Select a LINE")
                    (setq E2 nil)
                  )
               )
            )
        )
     ) ;endwhile
     (setq P1 (cdr (assoc 10 (entget E1)))) ; start point line 1
     (setq P2 (cdr (assoc 11 (entget E1)))) ; end point line 1
     (setq P3 (cdr (assoc 10 (entget E2)))) ; start point line 2
     (setq P4 (cdr (assoc 11 (entget E2)))) ; end point line 2
     (setq X1 (car P1) Y1 (cadr P1) Z1 (caddr P1))  ; components of P1
     (setq X2 (car P2) Y2 (cadr P2) Z2 (caddr P2))  ;   "   "   "   P2
     (setq X3 (car P3) Y3 (cadr P3) Z3 (caddr P3))  ;   "   "   "   P3
     (setq X4 (car P4) Y4 (cadr P4) Z4 (caddr P4))  ;   "   "   "   P4
     (setq A (+ (* (- X2 X1)(- X1 X3)) (* (- Y2 Y1)(- Y1 Y3)) (* (- Z2 Z1)(- Z1 Z3))))
     (setq D (+ (* (- X4 X3)(- X1 X3)) (* (- Y4 Y3)(- Y1 Y3)) (* (- Z4 Z3)(- Z1 Z3))))
     (setq B (+ (* (- X2 X1)(- X2 X1)) (* (- Y2 Y1)(- Y2 Y1)) (* (- Z2 Z1)(- Z2 Z1))))
     (setq C (+ (* (- X2 X1)(- X4 X3)) (* (- Y2 Y1)(- Y4 Y3)) (* (- Z2 Z1)(- Z4 Z3))))
     (setq F (+ (* (- X4 X3)(- X4 X3)) (* (- Y4 Y3)(- Y4 Y3)) (* (- Z4 Z3)(- Z4 Z3))))
     (setq CA (ABS (/ C (* (SQRT B)(SQRT F))))) ;Cosine CA=1 
     (setq SA (SQRT (ABS (- 1 (* CA CA))))) ;Sine SA=0
     (setq ANG (ATAN SA CA))
     (princ (strcat "\nAngle = " (angtos ANG 0 4)))
     (IF (< ANG 0.000005) 
     (princ "\nLines are parallel - No connector\n")
        (progn
           (setq R1 (/ (- (* A C) (* B D)) (- (* C C) (* B F))))
           (setq R (/ (- (* C R1) A) B))
           ; connector end pnts
           (setq P5 (LIST (+ X1 (* (- X2 X1) R))(+ Y1 (* (- Y2 Y1) R))(+ Z1 (* (- Z2 Z1) R))))  
           (setq P6 (LIST (+ X3 (* (- X4 X3) R1))(+ Y3 (* (- Y4 Y3) R1))(+ Z3 (* (- Z4 Z3) R1))))
           (setq DS (distance P5 P6)) ; connector length
           (if (or (< 1 R) (< 1 R1))
              (princ " * * * CAUTION: Connector past end of Line 1 or 2"))
           (if (or (< R 0) (< R1 0))
              (princ " * * * CAUTION: Connector past end of Line 1 or 2"))
           (princ (strcat "\nConnector length = " (rtos DS)))
           (if (> DS 0.00000000001) 
              (command ".LINE" P5 P6 "")
              (princ  "\nLines intersect - no connection")
           )
        );endprogn
     );endif
     (setq *error* sys_error)
     (command "UCS" "R" "SYSUCS")
     (command "UCS" "D" "SYSUCS")
     (setvar "OSMODE" OLDSNAP)
     (setvar "CMDECHO" 1)
     (princ "\r")
     (redraw)
     (princ)
)

Link to comment
Share on other sites

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