Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
XDRX-API
»
Topic:
[XDrX-Function(1)] Entity projected onto the plane of the current UCS
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: [XDrX-Function(1)] Entity projected onto the plane of the current UCS (Read 1061 times)
0 Members and 1 Guest are viewing this topic.
xdcad
Swamp Rat
Posts: 527
WWW
[XDrX-Function(1)] Entity projected onto the plane of the current UCS
«
on:
November 24, 2023, 03:41:57 AM »
https://www.theswamp.org/index.php?topic=58129.0
Code - Auto/Visual Lisp:
[Select]
;|
Get the Z axis of UCS
Parameters: none
Return value: vector
|;
(
defun
XD::UCS:zDir
(
)
(
xdrx_vector_crossProduct
(
getvar
"ucsxdir"
)
(
getvar
"ucsydir"
)
)
)
Code - Auto/Visual Lisp:
[Select]
;|
Function name: XD::Project->UCSPLANE
effect:The solid is projected onto the current UCS plane
param:
ss -- Selection or Entity List
return: selection or entity list
|;
(
defun
XD::Project
->
UCSPLANE
(
ss
/
ents plane g g1 e1
)
(
if
(
=
(
type
ss
)
'PICKSET
)
(
setq
ss
(
xdrx
-
pickset
->
ents ss
)
)
)
(
setq
plane
(
xdge::constructor
"kPlane"
(
getvar
"ucsorg"
)
(
XD::UCS:zDir
)
)
)
;Coordinate UCS PLANE AcGe kPlane
(
mapcar
'
(
lambda
(
x
)
(
setq
g
(
xdge::constructor x
)
)
; Generate AcGe curve from AcDb curve
(
setq
g1
(
xdge::getpropertyvalue g
"orthoproject"
plane
)
)
;Geometric curves are orthogonally projected onto the plane plane
(
setq
e1
(
xdge::entity:make g1
)
)
;Generate entity after projection
(
xdrx
-
entity
-
matchprop x e1
)
;The entity attributes match the original curve, color, layer, linetype....
(
xdrx
-
object
-
swapid e1 x
)
;Entity ObjectId exchange to ensure that the newly generated curve entity name remains unchanged
(
xdrx
-
entity
-
delete e1
)
;Delete the original curve
(
xdrx
-
object
-
release g
)
;Geometric curve entities release memory
)
ss
;Select set to entity table
)
(
xdge::free plane
)
;Geometry plane object releases memory
(
if
(
=
(
type
ss
)
'PICKSET
)
(
xdrx_entity
->
pickset ss
)
ss
)
)
Code - Auto/Visual Lisp:
[Select]
;|
Function name: XD::Project->PLANE
effect:The entity is projected onto the plane specified by the Z-axis vector
param:
ss -- Selection or Entity List
normal-- Projecttion Plane Z axis da unit vector
return: selection or entity list
|;
(
defun
XD::Project
->
PLANE
(
ss normal
/
ents plane g g1 e1
)
(
if
(
=
(
type
ss
)
'PICKSET
)
(
setq
ss
(
xdrx
-
pickset
->
ents ss
)
)
)
(
setq
plane
(
xdge::constructor
"kPlane"
'
(
0
0
0
)
normal
)
)
;Coordinate PLANE AcGe kPlane
(
mapcar
'
(
lambda
(
x
)
(
setq
g
(
xdge::constructor x
)
)
; Generate AcGe curve from AcDb curve
(
setq
g1
(
xdge::getpropertyvalue g
"orthoproject"
plane
)
)
;Geometric curves are orthogonally projected onto the plane plane
(
setq
e1
(
xdge::entity:make g1
)
)
;Generate entity after projection
(
xdrx
-
entity
-
matchprop x e1
)
;The entity attributes match the original curve, color, layer, linetype....
(
xdrx
-
object
-
swapid e1 x
)
;Entity ObjectId exchange to ensure that the newly generated curve entity name remains unchanged
(
xdrx
-
entity
-
delete e1
)
;Delete the original curve
(
xdrx
-
object
-
release g
)
;Geometric curve entities release memory
)
ss
;Select set to entity table
)
(
xdge::free plane
)
;Geometry plane object releases memory
(
if
(
=
(
type
ss
)
'PICKSET
)
(
xdrx_entity
->
pickset ss
)
ss
)
)
Code - Auto/Visual Lisp:
[Select]
(
defun
c:tt
(
)
(
if
(
setq
ss
(
xdrx
-
ssget
"
\n
Select entities to be projected onto the current UCS plane <exit>:"
)
)
(
progn
(
setq
ss
(
xd::project
->
ucsplane ss
)
)
(
xdrx
-
entity
-
redraw
ss
1
)
)
)
(
princ
)
)
«
Last Edit: December 04, 2023, 01:27:35 PM by xdcad
»
Logged
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
XDRX-API
»
Topic:
[XDrX-Function(1)] Entity projected onto the plane of the current UCS