Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to divide dimension line in points

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
miroslav.pristov
3706 Views, 21 Replies

How to divide dimension line in points

Hello all again i have some question for you experts

 

I have some dimension line from point A to B. I need that line to be divided like on the picture in points i define on drawing 

. can someone help me on this please. I cant find solution for this. I try the whole morning. here is the picture

 

help.png

21 REPLIES 21
Message 2 of 22
dbroad
in reply to: miroslav.pristov

Unless I do not understand your problem, you should be able to use qdim to do this task.

 

Sequence:

Qdim

Select dimension

Choose Edit

Pick new dimension points

Pick new dimension line location.

Architect, Registered NC, VA, SC, & GA.
Message 3 of 22
miroslav.pristov
in reply to: dbroad

thank you for your answer.

 

Yes i know but i want some lisp shortcut for that. And the new dimension lines to replace the old single one on same spot. Is it posible

 

 

Message 4 of 22

like i choose dimension line in first step, pick points in second and the dimension line is changed in 3rd step

Message 5 of 22
dbroad
in reply to: miroslav.pristov

So you tried a whole morning to divide these dimensions by using lisp just to save 1-2 seconds?  How much time does typing QDIM and using the E option really take you?

 

Someone else will be along shortly if you are willing to wait for a complete packaged solution but the process is:

 

(defun c:mycommandname (<no arguments> / <local variables as you wish>)

.... your input output

(command "qdim" answers to prompts)

(princ)

 

)

Architect, Registered NC, VA, SC, & GA.
Message 6 of 22
miroslav.pristov
in reply to: dbroad

thank you for patience mister, 

 

i m not good in this and this solution will help me a lot. i ll wait for solution.

Message 7 of 22


@miroslav.pristov wrote:

like i choose dimension line in first step, pick points in second and the dimension line is changed in 3rd step


As @dbroad said, this one is really basic, does not take a lot to learn to be able do that...

 

First you need to select points, then existing dim twice.

 

(defun c:QDimSplit (/ ss i)
  
  (if (and (princ "\nSelect POINTS to split existing dimension, ")
	   (setq ss (ssget '((0 . "POINT")))))
    (progn
      (command "_.QDIM"
	       PAUSE ""
	       "_E"
	       "_A")
      (repeat (setq i (sslength ss))
	(command (cdr (assoc 10 (entget (ssname ss (setq i (1- i))))))))
      (command "_X"
	       PAUSE)))
  (princ)
)
Message 8 of 22

And i forgot to say in begining and this is a big point in this case, i need this command to automatically change UCS world sistem to dimension line system and after all is done to return UCS world sistem. 

Message 9 of 22

Yes it work but not on the way i wanted...

 

in this case i must draw points and then select them and then select dimension line. And it wont work if Dimension line is not in world UCS

 

the point is to first select line and chose their UCS, then to click some points on drawing, then the line to be divided and then evtything to go back to UCS world

Message 10 of 22


@miroslav.pristov wrote:

Yes it work but not on the way i wanted...

 

in this case i must draw points and then select them and then select dimension line. And it wont work if Dimension line is not in world UCS

 

the point is to first select line and chose their UCS, then to click some points on drawing, then the line to be divided and then evtything to go back to UCS world


Ouu sorry, is this way you wanted it? You might post dwg next time!!!

 

(defun c:QDimSplit (/ ss en pt)
  
  (setq en (entsel "\nSelect dimension: "))
  (command "_UCS"
	   "_OB"
	   en
	   "_.QDIM"
	   en ""
	   "_E"
	   "_A")
  (while (setq pt (getpoint "\nPoint <exit>: ")) (command "_none" pt))
  (command)
  (command PAUSE
	   "_UCS"
	   "_P")
  (princ)
)
Message 11 of 22

Hi, thank you its beter but stil wont work especially if i have dimension line in UCS thats not equal to world one. something like aligned dimension. But if i put ucs in direction of dimension line before command it will work. I think there is a error somewhere, the command doesnt recognize the ucs of dimensional line. 

Message 12 of 22

It works good with Linear (rotated) dims in any UCS.

QDIM command fails on Aligned dim. No matter what UCS is currently set.

 

You can try this routine as well. It does not work on UCS - just add (command "_.ucs" "_w") at the begining and (command "_.ucs" "_p") at the end.

(I know... it's not exactly what you want.. atleast it works)

Message 13 of 22

did you try your command with linear rotated dimension line and keeping the world ucs? when you divide the line , the command only gives new dimension lines in direction of X or Y world usc system depending of direction where you click. you cant divide the existing line. you erase the old one and make new ones in other ucs. I think the comand is good but need a modification to put ucs (either X or Y direction of it) parallel with dimension line. if that is solve i think everything will be ok.

 

I saw the routine you said. It work great, better then your rutine, but there are to many repeating especially if there is too much points.

 

So we must change something...

Message 14 of 22


@miroslav.pristov wrote:

did you try your command with linear rotated dimension line and keeping the world ucs? when you divide the line , the command only gives new dimension lines in direction of X or Y world usc system depending of direction where you click. you cant divide the existing line. you erase the old one and make new ones in other ucs. I think the comand is good but need a modification to put ucs (either X or Y direction of it) parallel with dimension line. if that is solve i think everything will be ok.

 


Don't follow you... can't replicate this issue. The routine modifies the coordinate system itself. It works for me.

The routine is based on QDIM command. If this command can't do it, then the routine can't that nether.

 

 


miroslav.pristov wrote:

I saw the routine you said. It work great, better then your rutine, but there are to many repeating especially if there is too much points.

 

So we must change something...


OK, if this routine fits to you better, then we (= I) can make it multiple.

 

I added a templine for aligned dims, you need to click on it for good alignment.

I added a temp dynamic line... you need to start from a point which is the most close to the connected end of the main dim.

 

Spoiler
;; codehimbelonga KerryBrown@theSwamp 2010.05.28
;; for multiple using modified by BeekeeCZ 2016.03.22

(defun c:SplitDims (/ sel newpt ent edata elist tmp)
  
  (command "_.UCS" "_W")
  
  (if (and (setq sel (entsel "\nSelect Dimension to Split: "))
	   (setq tmp (entmakex (list '(0 . "LINE")
				     (cons 10 (cdr (assoc 13 (entget (car sel)))))
				     (cons 11 (cdr (assoc 14 (entget (car sel)))))))))
    (while (setq newpt (getpoint (cdr (assoc 14 (entget (car sel)))) "\nSelect new Dim Point closer line connected point <exit>: "))
      (progn (setq ent (car sel)
		   edata (entget ent)
		   elist (vl-remove-if
			   '(lambda (pair)
			      (member (car pair)
				      (list -1 2 5 102 310 300 330 331 340 350 360 410)
				      )
			      )
			   edata
			   )
		   )
	(entmod (subst (cons 14 newpt) (assoc 14 elist) edata))
	(entmakex (subst (cons 13 newpt) (assoc 13 elist) elist))
	)
      )
    )

  (if tmp (entdel tmp))
  (command "_.UCS" "_P")
  (princ)
)

 

Message 15 of 22

thank you for zour time now it works graet

Message 16 of 22

can i ask you something more about this LISP command for spliting dimension line. is there a chance to make split lines to have exatly the same format as the original dimension line, because the new lines change a format especially at lenght of extension lines, i didnt notice any other chenges but maybe there aare some more. Thank you

Message 17 of 22

can someone plese help me to modify this lisp to work for aligned dimension as it works for linear. if i break aligned dimension in some point which is not on line from which i took dimensions i dont get what i want. 

 

here is a lisp and example file with problem i have

 

Thank you, i really appreciate if someone could help 

Message 18 of 22


@miroslav.pristov wrote:

can someone plese help me to modify this lisp to work for aligned dimension as it works for linear. if i break aligned dimension in some point which is not on line from which i took dimensions i dont get what i want. 

 

here is a lisp and example file with problem i have

 

Thank you, i really appreciate if someone could help 


Hi... as I said before, you were supposed to click on a temp line..
Anyway, I modified it and now it's not necessary.

 

(vl-load-com)

(defun c:SplitDims (/ sel newpt ent edata elist tmp)
  
  (command "_.UCS" "_W")
  
  (if (and (setq sel (entsel "\nSelect Dimension to Split: "))
	   (setq tmp (entmakex (list '(0 . "LINE")
				     (cons 10 (cdr (assoc 13 (entget (car sel)))))
				     (cons 11 (cdr (assoc 14 (entget (car sel)))))))))
    (while (and (setq newpt (getpoint (cdr (assoc 14 (entget (car sel)))) "\nSelect new Dim Point closer line connected point <exit>: "))
		(setq newpt (vlax-curve-getClosestPointTo tmp newpt))
		)
      (progn (setq ent (car sel)
		   edata (entget ent)
		   elist (vl-remove-if
			   '(lambda (pair)
			      (member (car pair)
				      (list -1 2 5 102 310 300 330 331 340 350 360 410)
				      )
			      )
			   edata
			   )
		   )
	(entmod (subst (cons 14 newpt) (assoc 14 elist) edata))
	(entmakex (subst (cons 13 newpt) (assoc 13 elist) elist))
	)
      )
    )

  (if tmp (entdel tmp))
  (command "_.UCS" "_P")
  (princ)
)
Message 19 of 22

thank you it works perfect

 

Message 20 of 22
Kent1Cooper
in reply to: ВeekeeCZ

That should be achievable without drawing a temporary Line, something like this [untested]:

 

  (if (setq sel (entsel "\nSelect Dimension to Split: "))
    (setq
      def1 (cdr (assoc 13 (entget (car sel))))
      def2 (cdr (assoc 14 (entget (car sel))))

    ); setq

  ); if
  (while (setq newpt (getpoint def2 "\nSelect new Dim Point <exit>: "));;; [or use def1 as reference]
    (setq newpt (inters def1 def2 newpt (polar newpt (+ (angle def1 def2) (/ pi 2)) 1) nil))
    ....

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost