Message 1 of 8
changing block dimension overall scale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, i am hoping for some help. the code below allows a user to select a block the code than loops through
the block entities looking for dimensions when it finds one it changes the overall dimscale to 1.
that all seams to work fine. the problem is the block instance is not updated until i go into
the block editor.
entupd and regen do nothing.
(defun c:test () (Setq DimScale 1.0) (Setq Blk (car (entsel "Select Block"))) (Setq blockName (cdr (assoc 2 (entget blk)))) (setq ent (cdr (assoc -2 (tblsearch "block" blockName)))) ;;get the first ent in the block (while ent (if (= (cdr (assoc 0 elst)) "DIMENSION") (progn (Setq elst (entget ent '("ACAD"))) ;;Get the XData that contains the dimscale (Setq DimScaleDXF (assoc -3 elst)) (Setq CurDimScale (assoc 1040 (cdadr DimScaleDXF))) ;; Get the current dimscale (if (not (equal (cdr CurDimScale) DimScale 0.001)) (progn ;;If its not equal update it (Setq DimXdata (subst (cons 1040 DimScale) (assoc 1040 (cdadr DimScaleDXF)) (cdadr DimScaleDXF) ) ) (Setq DimXdata (append (list -3) (list (append (list "ACAD") DimXdata)) ) ) (Setq elst (subst DimXdata (assoc -3 elst) elst ) ) (entmod elst) (entupd ent) ;;For some reason this does not update the block (entupd Blk) ) ) ) ) (setq ent (entnext ent)) ) )