Results 1 to 4 of 4

Thread: Update Dimension Property

  1. #1
    Member freedomonek's Avatar
    Join Date
    2006-05
    Location
    Columbus, Oh
    Posts
    48

    Default Update Dimension Property

    Hello All,

    I'm trying to put together a routine that will:
    1. Select all Dimensions in Paper Space and
    2. Capture the DimLinearFac of All.
    3. If the DimLinearFac value has been modified, keep it as is.
    4. If it is the default (1), change it to a value of "48".

    Below is an attempt at it, to start. I was able to get one dim to update. Then I added the Foreach loop and nothing updates.


    Code:
    ;; attemps to select all Dimenision in Paperspace and chand the DIMLFAC to factor of 48. 
    (setq ss (ssget "x" '((0 . "DIMENSION"))) )
    (setq n (sslength SS))
    (setq na (ssname SS 0))
    (setq b (entget na))  
    
    (vl-load-com)					  ; visual lisp extensions
    (setq vladim (vlax-ename->vla-object NA))		  ;convert to visual-lisp object
    
      (foreach cycleThru vladim				   ;The Loop
    	(progn
    	(vlax-put-property   cycleThru "LinearScaleFactor" 48)	;Sets value
    	(vlax-release-Object cycleThru)			;updates object
    	); End Progn
      );End Foreach
    (princ)
    Thanks for your help!

    Kelley

  2. #2
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233

    Default Re: Update Dimension Property

    Give this a shot. I believe the problem was the vla-object you were creating. So in the version below i iterate through each entity in the selection set and conver each entity to a vla object then store it to a list and then process the new list.

    Code:
    ;; attemps to select all Dimenision in Paperspace and chand the DIMLFAC to factor of 48. 
    (defun C:DIMLFACCHG ()
    (vl-load-com)					  ; visual lisp extensions
    (setq ss (ssget "x" '((0 . "DIMENSION"))) )
    (setq n (sslength SS))
      (setq count 0)
      (setq objlist nil)
    
      ;; get the name of each object in the list and convert it to a vla-object and then store it to a new list
      (repeat n
        (progn
        (setq na (ssname SS count))
        (setq vladim (vlax-ename->vla-object na))		  ;convert to visual-lisp object
        (setq objlist (if objlist (append objlist (list vladim))(list vladim)))
        (setq count (1+ count))
        );; end of progn
     );; end of repeat
    
      (foreach each objlist				   ;The Loop
        (if (=(vla-get-linearscalefactor each) 1)
    	(vla-put-linearscalefactor each 48)	;Sets value
    	;(vlax-release-Object each)			;updates object
        ); End if
      );; end of foreach statement
    );; end of defun
    (princ)

  3. #3
    Member freedomonek's Avatar
    Join Date
    2006-05
    Location
    Columbus, Oh
    Posts
    48

    Default Re: Update Dimension Property

    Thanks Lions60 for your insight.

    Your solution works perfect!

    Last edited by freedomonek; 2008-11-12 at 02:58 PM. Reason: Solution did work after all!

  4. #4
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233

    Default Re: Update Dimension Property

    Glad I could help.

Similar Threads

  1. Replies: 3
    Last Post: 2008-01-22, 04:18 PM
  2. PROPERTY SETS ON A DIMENSION
    By jo.moens in forum ACA General
    Replies: 6
    Last Post: 2006-08-15, 08:07 AM
  3. dimension update
    By rwbaker in forum VBA/COM Interop
    Replies: 0
    Last Post: 2006-03-28, 03:44 PM
  4. Dimension Arrowheads and Viewport property Hide Plot
    By jhale.77541 in forum AutoCAD Plotting
    Replies: 6
    Last Post: 2005-08-16, 10:13 PM
  5. How to Update Property Set Definitions?
    By jsnyder.68308 in forum ACA General
    Replies: 4
    Last Post: 2005-05-11, 10:57 PM

Posting Permissions

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