Results 1 to 5 of 5

Thread: Defining 3D Point

  1. #1
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Defining 3D Point

    Hi ALL,

    I am going to drawing 3d line but I don't know how to define two 3D points.
    Two points are relative to the insert point IPt.
    Point 1: @(0,0,50)
    Point 2: @(50,0,50)

    The following is what I did.
    Your helps would be much appreciated.

    Code:
    (defun c:TEST (/ IPt Pt1 Pt2)
     
      (setq IPt (getpoint "\nselect Insert Point: "))
     
      (setq
        PT1 (polar IPt Angle & Distance)
        PT2 (polar PT1 Angle & Distance)
      ) ;end setq
     
    ...
     
      (princ)
    )

  2. #2
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    201
    Login to Give a bone
    0

    Default Re: Defining 3D Point

    Hi,

    You can't use polar for this.
    polar is 2d working (the specified angle is an angle on XY plane)

    Doing @0,0,50 you specify a displacement, (0 0 50) can be considered as a vector.
    So, the easy way is to add to each coordinates of IPt the corresponding coordinate of the vector:

    Code:
    (setq Pt1 (list (+ (car IPt) 0) (+ (cadr IPt) 0) (+ (caddr IPt) 50))
          Pt2 (list (+ (car IPt) 50) (+ (cadr IPt) 0) (+ (caddr Ipt 50)))
    )
    This way is quite uggly and not so easy to read,
    AutoLISP provides the mapcar fuction does the same job, you'd rather write:

    Code:
    (setq Pt1 (mapcar '+ IPt '(0 0 50))
          Pt2 (mapcar '+ IPt '(50 0 50))
    )

  3. #3
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: Defining 3D Point

    Quote Originally Posted by 'gile' View Post
    Hi,
    You can't use polar for this.
    polar is 2d working (the specified angle is an angle on XY plane)
    Thanks.
    But what if Point 1 was known as:
    1) angle = 30 degree relative to X axis;
    2) y = 50;
    3) z = 50;
    instead of @(0,0,50)
    Last edited by BoKirra; 2008-12-09 at 02:00 AM.

  4. #4
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    201
    Login to Give a bone
    0

    Default Re: Defining 3D Point

    Hi,

    There're 3 ways to define a 3d point relative coordinates

    1- @x,y,z
    2- @distance<[angle about X axis],z (cylindric)
    3- @distance<[angle about X axis]<[angle about XY plane] (spheric)

    Assuming=:
    - org is the orign point (@)
    - pt the point to calculate
    - p0 the projection of pt on the plane parallel to XY plane which contains org
    x, y, z are coordinates
    a1 is an angle about XY axis (radians)
    a2 is an angle about XY plane (radians)

    @x,y,z
    Code:
    (setq pt (mapcar '+ org (list x y z)))
    @d<a1,z
    Code:
    (setq p0 (polar org a1 d)
          pt (list (car p0) (cadr p0) (+ (caddr p0) z))
    )
    @d<a1<a2
    Code:
    (setq p0 (polar org a1 (* d (cos a2)))
          pt (list (car p0) (cadr p0) (+ (caddr p0) (* d (sin a2))))
    )

  5. #5
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: Defining 3D Point

    Quote Originally Posted by 'gile' View Post
    Hi,

    There're 3 ways to define a 3d point relative coordinates

    1- @x,y,z
    2- @distance<[angle about X axis],z (cylindric)
    3- @distance<[angle about X axis]<[angle about XY plane] (spheric)

    Assuming=:
    - org is the orign point (@)
    - pt the point to calculate
    - p0 the projection of pt on the plane parallel to XY plane which contains org
    x, y, z are coordinates
    a1 is an angle about XY axis (radians)
    a2 is an angle about XY plane (radians)

    @x,y,z
    Code:
    (setq pt (mapcar '+ org (list x y z)))
    @d<a1,z
    Code:
    (setq p0 (polar org a1 d)
          pt (list (car p0) (cadr p0) (+ (caddr p0) z))
    )
    @d<a1<a2
    Code:
    (setq p0 (polar org a1 (* d (cos a2)))
          pt (list (car p0) (cadr p0) (+ (caddr p0) (* d (sin a2))))
    )
    Thanks. It's great.

Similar Threads

  1. CV104-1P: One Point, Two Point, Red Point, Blue Point
    By Autodesk University in forum Civil Infrastructure
    Replies: 0
    Last Post: 2013-05-05, 03:17 AM
  2. CV12-4: One Point, Two Point, Red Point, Blue Point
    By Autodesk University in forum Civil Infrastructure
    Replies: 0
    Last Post: 2013-04-17, 04:50 AM
  3. Defining: FullClassName
    By mme.peel28292390 in forum Revit - API
    Replies: 0
    Last Post: 2011-09-29, 01:16 PM
  4. 2D Section - Defining Line
    By tatriest in forum ACA General
    Replies: 2
    Last Post: 2005-07-24, 01:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •