FlattenLite to flatten only dimension points & aligned dimension points

FlattenLite to flatten only dimension points & aligned dimension points

anton_chmidt
Advocate Advocate
558 Views
5 Replies
Message 1 of 6

FlattenLite to flatten only dimension points & aligned dimension points

anton_chmidt
Advocate
Advocate

I am having problem with some of my .dwg`s. Some of the dimensions and/or linear dimensions have dimension points that are flying randomly on Z-axel. (See attached photo.)

 

I tried Flattening, but it is not working with those points for some reason. (Edit: Flattening is working if I select dimensions after command. I was trying qselect all dimensions and then run flattening before, without success) Plus I feel like it is too heavy tool for such limited object type flattening. ( No need to check everything and get stuck in a process to just move couple of dimension points) 

 

 

I also tried to Google this and found something called Superflatten.lsp especially versio 1.2e but it was 13 year old thread and I could not find attached file. Plus again it might be even heavier flattener.

 

Unfortunately for now I cannot provide the .dwg for test purposes. If it's absolutely necessary I can try to replicate one for posting here

 

  • Thanks for everyone who can help on this 
0 Likes
Accepted solutions (2)
559 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

I think this does what you're asking [minimally tested]:

(defun C:DDPZ0 (/ ss n edata); = Dimension Definition Points to Z=0
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (repeat (setq n (sslength ss)); then
      (setq edata (entget (ssname ss (setq n (1- n)))))
      (foreach dxf '(13 14)
        (setq edata (subst (reverse (cons 0.0 (cdr (reverse (assoc dxf edata))))) (assoc dxf edata) edata))
      ); foreach
      (entmod edata)
    ); repeat
  ); if
  (prin1)
); defun

 

Kent Cooper, AIA
0 Likes
Message 3 of 6

anton_chmidt
Advocate
Advocate
This asks for an object, could it just select all dimensions and align dimensions or select all that aren't already flat, without asking anything? But yes quick testing was working as along as I select the dimensions manually
0 Likes
Message 4 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

@anton_chmidt wrote:
This asks for an object, could it just select all dimensions ....

To select all, change this line:

(if (setq ss (ssget '((0 . "DIMENSION"))))

to this:

(if (setq ss (ssget "_X" '((0 . "DIMENSION"))))

[To select all those "that aren't already flat" might be possible in filtering, though complicated -- it's much simpler just to select all, since it won't change anything about those that are already flat.  It could also be made to select all, and check each one for the Z coordinates of its definition points, and apply the change only if needed, but again, since applying it regardless will leave unchanged those already flat, it's simpler to just let it do them all.]

Kent Cooper, AIA
0 Likes
Message 5 of 6

anton_chmidt
Advocate
Advocate

Just a small question to educate myself. I noticed you used prin1 instead of usual princ, any reason for that in this case? 

0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

@anton_chmidt wrote:

.... I noticed you used prin1 instead of usual princ, any reason for that in this case? 


I have taken to using (prin1) only because it is under that function's entry in the AutoLisp Reference that using it with no arguments is described as a way to exit "quietly."  Neither (princ) nor (print) has that mentioned.  I suspect (princ) has come to be the predominant one because in the related-concept page called "About Exiting a Function Quietly," that's the function mentioned.  But any of the three (prinxfunctions with no arguments will do.

Kent Cooper, AIA
0 Likes