Trouble Creating Shapes in 3D

Trouble Creating Shapes in 3D

mgorecki
Collaborator Collaborator
853 Views
7 Replies
Message 1 of 8

Trouble Creating Shapes in 3D

mgorecki
Collaborator
Collaborator

 

I have a program that creates a3D model, but when I want to add a drill hole on the side, it just doesn't use the selected UCS or view side.

I set the right view and even a UCS, but the circle in this case comes in flat, like I'm using the "World" UCS.

holes.jpg

 

 

 

 

 

 

 

 

 

 

 

 (command "_-view" "front")
 (command "_-view" "_swiso")
 (command "ucs" "3p" (list 0 0 0) (list 1 0 0) (list 0 0 1))
 (setq sideDrillLoc (list (car unitCenter) (* sideVacCentToTop -1) (* (+ hbRaisedAreaStartZ 1) -1)))
 (CreateCircle sideDrillLoc (/ sideVacHoleDia 2.0))

Any help getting this to come in right would be greatly appreciated.

0 Likes
Accepted solutions (1)
854 Views
7 Replies
Replies (7)
Message 2 of 8

Moshe-A
Mentor
Mentor

@mgorecki  hi,

 

The result shows that the right ucs is not properly set that's why the drill is placed on the XY plane of WCS.

you did not provide all the code you have so we do not knows what "front" & "swiso" views are?!

also these variables and function call 

 

 

(setq sideDrillLoc (list (car unitCenter) (* sideVacCentToTop -1) (* (+ hbRaisedAreaStartZ 1) -1)))
 (CreateCircle sideDrillLoc (/ sideVacHoleDia 2.0))

 

 

 

here is a more simple lisp command called CDRILL that illustrate how this could be done:

 

 

(defun c:cdrill ()
 (command "._ucs" "_save" "cdrill") ; save ucs
  
 ; here you must set the proper 3d view or preset a 3d view  
  
 (command-s "._ucs" "_3p") ; establish ucs on face
 (command-s "._circle")

 (command "._ucs" "_restore" "cdrill") ; restore ucs
)  

 

 

enjoy

moshe

 

0 Likes
Message 3 of 8

doaiena
Collaborator
Collaborator

Is the "CreateCircle" function using the "vla-AddCircle" method by any chance? If so, change it to entmake, because vla-Add... works in WCS.

0 Likes
Message 4 of 8

mgorecki
Collaborator
Collaborator

Hello Moshe,

Thanks, I did try that but unfortunately the circle appeared flat (world ucs, top view) and not rotated as it should appear in the side view ucs.

0 Likes
Message 5 of 8

mgorecki
Collaborator
Collaborator

Hi doaiena,

Thanks for the info, I didn't know that about vla-AddCircle.  I am using entmake and it still draws the circle flat like in top view and not rotated in the side view.

0 Likes
Message 6 of 8

mgorecki
Collaborator
Collaborator

Since I tried setting the UCS in different ways, and the circle still showed up perpendicular to the side I wanted it to be on (world Top view, not world side view), I just ended up placing the circle, then rotating it about its center.

 (CreateCircle sideDrillLoc (/ sideVacHoleDia 2.0))  <-- entmakes a circle given the center and radius
 (setq sideDrill (entlast))
 (command "rotate3d" sideDrill "" "x" sideDrillLoc 90)   <--use "rotate3d" and NOT "3dRotate".  "x" is the axis to rotate around

It stinks to have to do it this way.  I mean I can change the UCS and manually put a circle in rotated correctly, but when using LiSP, it just wont create the circle rotated correctly.

0 Likes
Message 7 of 8

doaiena
Collaborator
Collaborator
Accepted solution

Rotating the circle is not really a solution. It's just adding another command on top of the existing code. If you are already using entmake to create the circles, you should set the property at that moment.

 

Example:

(entmakex (list (cons 0 "CIRCLE") (cons 10 (list 0 0 0)) (cons 40 50) (cons 210 (list 0 0 1))))
(entmakex (list (cons 0 "CIRCLE") (cons 10 (list 0 0 0)) (cons 40 50) (cons 210 (list 0 1 0))))
(entmakex (list (cons 0 "CIRCLE") (cons 10 (list 0 0 0)) (cons 40 50) (cons 210 (list 1 0 0))))

You can use the "trans" function to convert from the current UCS

0 Likes
Message 8 of 8

mgorecki
Collaborator
Collaborator

Hi doaiena,

That worked perfectly.  I need to brush up some more on my DXF code references.

 

Thank you very much!

Mark

0 Likes