Results 1 to 5 of 5

Thread: Entmake UCS - error

  1. #1
    Member
    Join Date
    2011-02
    Posts
    17
    Login to Give a bone
    0

    Default Entmake UCS - error

    I want to create UCS using entmake command but it always return nil and noting heppend. Please help mi with folowing code:

    (setq ut (getpoint "\nTočka u osi presjeka"))
    (setq ut2 (getpoint "\nTočka na pozitivnoj strani presjeka"))

    ;namještanje ucsa++

    (setq ut3 (list (car ut) (cadr ut) 100))
    (vlax-3d-point apt)

    (entmake (list
    (cons 0 "UCS")
    (cons 100 "AcDbSymbolTableRecord")
    (cons 100 "AcDbUCSTableRecord")
    (cons 2 "test")
    (cons 70 0)
    (cons 10 (trans ut 1 0))
    (cons 11 (trans ut2 1 0))
    (cons 12 (trans ut3 1 0))
    (cons 79 0)
    (cons 146 0.0)
    )
    )

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Entmake UCS - error

    not sure how you create a UCS, I've never heard of it before. If you are trying to modify the current ucs (by rotating it) you can use the simple ucs command with a combination of inputs to achieve the desired results.

  3. #3
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Entmake UCS - error

    Try this :

    Code:
    ;; Unit Vector
    (defun vec1 ( v )
      (if (>= (setq d (distance '(0 0 0) v)) 1e-14)
        (mapcar '(lambda (x) (/ x d)) v)
      )
    )
    
    (defun c:entmucs ( / adoc ut ut2 ut3 ucsent ucsenta ) (vl-load-com)
    (vl-cmdf "_.UCS" "w")
    (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
    (setq ut (getpoint "\nTocka u osi presjeka : "))
    (setq ut2 (getpoint ut "\nTocka na pozitivnoj strani presjeka : "))
    
    ;namjestanje ucsa++
    
    (setq ut3 (list (car ut) (cadr ut) 100))
    
    (entmake (list
    (cons 0 "UCS")
    (cons 100 "AcDbSymbolTableRecord")
    (cons 100 "AcDbUCSTableRecord")
    (cons 2 "test")
    (cons 70 0)
    (cons 10 (trans ut 1 0))
    (cons 11 (vec1 (mapcar '- (trans ut2 1 0) (trans ut 1 0))))
    (cons 12 (vec1 (mapcar '- (trans ut3 1 0) (trans ut 1 0))))
    (cons 79 0)
    (cons 146 0.0)
    )
    )
    (setq ucsent (tblobjname "UCS" "test"))
    (setq ucsenta (vlax-ename->vla-object ucsent))
    (vla-put-activeucs adoc ucsenta)
    (vl-cmdf "_.UCS" "d" "test")
    (princ)
    )

  4. #4
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Entmake UCS - error

    Or if you want to continue to change ucs from already entmake ucs, try this :

    Code:
    ;; Vector Cross Product - Lee Mac
    ;; Args: u,v - vectors in R^3
    
    (defun v^v ( u v )
      (list
        (- (* (cadr u) (caddr v)) (* (cadr v) (caddr u)))
        (- (* (car  v) (caddr u)) (* (car  u) (caddr v)))
        (- (* (car  u) (cadr  v)) (* (car  v) (cadr  u)))
      )
    )
    
    ;; Unit Vector - Lee Mac
    ;; Args: v - vector in R^n
    
    (defun unit ( v )
      ( (lambda ( n ) (if (equal 0.0 n 1e-14) nil (vxs v (/ 1.0 n)))) (norm v))
    )
    
    ;; Vector x Scalar - Lee Mac
    ;; Args: v - vector in R^n, s - real scalar
    
    (defun vxs ( v s )
      (mapcar '(lambda ( n ) (* n s)) v)
    )
    
    ;; Vector Norm - Lee Mac
    ;; Args: v - vector in R^n
    
    (defun norm ( v )
      (sqrt (apply '+ (mapcar '* v v)))
    )
    
    (defun c:entmucs ( / adoc ut ut21 ut22 ut3 ucsent ucsenta ) (vl-load-com)
    (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
    (setq ut (getpoint "\nTocka u osi presjeka : "))
    (setq ut21 (getpoint ut "\nTocka na pozitivnoj strani presjeka : "))
    (setq ut22 (getpoint ut "\nTocka u ravni od koje podjesavam Z osu novog ucsa : "))
    
    ;namjestanje ucsa++
    
    (setq ut3 (mapcar '+ ut (v^v (mapcar '- ut21 ut) (mapcar '- ut22 ut))))
    
    (entmake (list
    (cons 0 "UCS")
    (cons 100 "AcDbSymbolTableRecord")
    (cons 100 "AcDbUCSTableRecord")
    (cons 2 "test")
    (cons 70 0)
    (cons 10 (trans ut 1 0))
    (cons 11 (unit (mapcar '- (trans ut21 1 0) (trans ut 1 0))))
    (cons 12 (unit (mapcar '- (trans ut3 1 0) (trans ut 1 0))))
    (cons 79 0)
    (cons 146 0.0)
    )
    )
    (setq ucsent (tblobjname "UCS" "test"))
    (setq ucsenta (vlax-ename->vla-object ucsent))
    (vla-put-activeucs adoc ucsenta)
    (vla-put-name (vla-get-activeucs adoc) "tst")
    (vl-cmdf "_.UCS" "d" "tst")
    (princ)
    )

  5. #5
    Member
    Join Date
    2011-02
    Posts
    17
    Login to Give a bone
    0

    Default Re: Entmake UCS - error

    Thanks Marko it works very well!!!!!

Similar Threads

  1. entmake
    By gagage in forum AutoLISP
    Replies: 12
    Last Post: 2010-08-12, 06:39 PM
  2. Help with entmake syntax
    By fclao in forum AutoLISP
    Replies: 1
    Last Post: 2010-05-25, 09:12 AM
  3. Example of EntMake
    By ccowgill in forum AutoLISP
    Replies: 8
    Last Post: 2009-08-24, 08:37 PM
  4. Entmake UCS
    By Takuwind in forum AutoLISP
    Replies: 6
    Last Post: 2006-08-04, 08:01 PM
  5. UCS vs entmake
    By scwegner in forum AutoLISP
    Replies: 5
    Last Post: 2005-08-26, 04:04 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
  •