Jump to content

HELP: Lisp to highlight dimensions that their objects it is snap to has shifted/moved


vernonlee

Recommended Posts

So, what that tells us is that ALL of the dimensions in the drawing are NON-Associative.

Too bad, because if they were associative, it would have flagged ONLY those which

had become disassociated from those entities which they were meant to describe, and would thus require your ministrations.

 

I have looked through the dimstyle manager help, and I don't see any way to change existing non-associative dimensions

to associative dimensions. The MATCHPROP command will copy annotative properties, if dimensions has

been selected in the SPECIAL PROPERTIES dialog for the command, and confer annotativity to a previously non-annotative dimension.

 

I don't know enough about lisp to be able to tell you whether or not a lisp based solution

could be created. I am inclined to think it probably could, but that is just conjecture on my part.

 

Should you wind up, as I suspect having to fix all of these one at a time, don't run too many O Snaps.

I would suggest just using Endpoint, Quadrant, Center & Midpoint. The less you need, the better,

as it will facilitate your quickly getting them where they are meant to be, without missed picks.

 

Good luck, maybe somebody else knows a way, or can suggest a lisp solution, sorry the dimensions turned out

to be non-associative, scuttling my initial approach to your problem.

 

So, what that tells us is that ALL of the dimensions in the drawing are NON-Associative.

Too bad, because if they were associative, it would have flagged ONLY those which

had become disassociated from those entities which they were meant to describe, and would thus require your ministrations.

 

I have looked through the dimstyle manager help, and I don't see any way to change existing non-associative dimensions

to associative dimensions. The MATCHPROP command will copy annotative properties, if dimensions has

been selected in the SPECIAL PROPERTIES dialog for the command, and confer annotativity to a previously non-annotative dimension.

 

I don't know enough about lisp to be able to tell you whether or not a lisp based solution

could be created. I am inclined to think it probably could, but that is just conjecture on my part.

 

Should you wind up, as I suspect having to fix all of these one at a time, don't run too many O Snaps.

I would suggest just using Endpoint, Quadrant, Center & Midpoint. The less you need, the better,

as it will facilitate your quickly getting them where they are meant to be, without missed picks.

 

Good luck, maybe somebody else knows a way, or can suggest a lisp solution, sorry the dimensions turned out

to be non-associative, scuttling my initial approach to your problem.

 

Roger. Thanks for your big help.

 

Could you clarify this sentence:-

"Should you wind up, as I suspect having to fix all of these one at a time, don't run too many O Snaps.

I would suggest just using Endpoint, Quadrant, Center & Midpoint. The less you need, the better,

as it will facilitate your quickly getting them where they are meant to be, without missed picks."

 

How will it facilitate ne quickly getting them where they are meant to be?

 

Thanks

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • vernonlee

    12

  • BIGAL

    9

  • Dadgad

    6

  • ReMark

    3

Top Posters In This Topic

Posted Images

No code but I would Chspace all the dims hopefully this will not cause to many dimscale problems then at least your working in one world not two, you could then via lisp pick a dim get its node pt and look within a box for a object getting its end point and then resetting the dim node to this pt which is what you want.

 

I think the message here is set it up right first go and advise everyone why it must be done this way.

 

There are some other posts here at Cadtutor about layout/model and dims it would be worthwhile trying to find them as they will have some good advice about the correct method to use. I am sure Remark will find a couple for you.

 

Hi BIGAL,

 

i am new to the company & i am only doing those 'simple' jobs. I am not allowed to do changes to the main drawings. My superiors are the only one doing the drawings. Part of my job is to just locate & adjust the dimensions.

Link to comment
Share on other sites

A bit extra pick a dim the Reassociate command will do it, but still needs work just need to find node co-ords looking now.

 

; this is an example of how to fix 1 dim
(setq pt1 (getpoint)) ; this would be replaced by the find end pt routine
(setq pt2 (getpoint)); this would be replaced by the find end pt routine
(setq obj (entsel "\npick dim")) ; again replace with loop of dims
; now for magic
(command "dimreassociate" obj "" pt1 pt2)
; all done for 1 

 

[ATTACH=CONFIG]50109[/ATTACH]

 

Do not quite understand. Is this a script or lisp?

 

Thanks

Link to comment
Share on other sites

Found this at the AutoDesk website.

 

"The Annotation Monitor flags non-associative annotations with a yellow exclamation marker and a red plus (+) icon appears in the drawing status bar. I've listed the sysvar details from the help file below. You may want to take a look at the AutoCAD Help for more details but briefly put, the Annotation Monitor works on Dimension Objects including Leaders and MLeaders."

 

Thanks ReMark for your help as well.

ReMark

user-offline.png

ReMark

user-offline.png

Link to comment
Share on other sites

Vernon, my point is that the most efficient way to do this, won't be with ALL your O snaps turned on.

For instance the NEAREST snap, while useful in some cases, I would not use for this, I would favor ENDPOINT,

or if the objects in question are 3D models then you could use the 3D Osnap Vertex.

If you will be working with circles, then turn on your Center and Quadrant O snaps.

Use the appropriate ones, the more you run, the greater the likelihood of an erroneous snap acquisition.

I use Perpendicular a lot, it is very helpful, but I turn it off when I am marking end points,

of hole centerline marks. It often causes the sort of issues you described in your first post.

It looks like the snap is acquired, and one is, just not the one you intended, still looks fine,

until you really zoom in, and see what O Snap point was actually selected . These differences are statistically insignificant,

and probably won't change the dimension text display, but if your boss notices, (good for him), and he cares,

then you need to find a technique which will comply with his minimum requirement, ACCURACY!

I hope that helps you, and that perhaps BIGAL will be able to assist you further, time permitting.

Link to comment
Share on other sites

Ok getting their 1st off thanks to Lee-Mac I found something that makes it very easy to do, the code below does 1 at a time next version will do lots.

 

; thanks to Lee-Mac for closest to routine
(defun GetClosestEndInSS (ss pt / GetPoints)
 (vl-load-com) ;; Lee Mac  ~  11.04.10
 (setq pt (trans pt 1 0))

 (defun GetPoints (ss / i ent lst)
   (setq i -1)
   (while (setq ent (ssname ss (setq i (1+ i))))
     (setq lst (cons (vlax-curve-getStartPoint ent)
                     (cons (vlax-curve-getEndPoint ent) lst))))
   lst)

 (car (vl-sort (GetPoints ss) (function (lambda (a b) (< (distance pt a)
                                                         (distance pt b)))))))

(defun c:REDIM (/ ss pt)
 (princ "\nPick Lines etc")
 (setq ss (ssget ))
 (setq obj (entsel "Pick dim"))
 (setq pickobj (entget (car obj)))
 (setq pt (assoc 13 pickobj)) ;1st node pt of dim
 (setq pt (list (cadr pt)(caddr pt))) ; convert to simple pt

 (setq pt1 (assoc 14 pickobj)) ;2nd node pt of dim
 (setq pt1 (list (cadr pt1)(caddr pt1))) ; convert to simple pt


(setq pt2 (GetClosestEndInSS ss pt)) ; find closest pt
(setq pt3 (GetClosestEndInSS ss pt1)) ; find closest pt
(command "dimreassociate" obj "" pt2 pt3) ; do the redim
 (princ)

) ;defun

Link to comment
Share on other sites

BIGAL, looks like you are going to make Vernon and his boss very happy with this, nice job. :beer:

Come to think of it, once you get it working for multiples, lots of people will probably find it useful!

Link to comment
Share on other sites

Ran into some big hurdles with plines didn't read lees code properly it joins to end pts not vertices, I think only way is what I thought first get dim node then do small window get all objects near find end/vertice then do dimreassoc, basicly have to start again. I am only looking at Model space dont even contemplate a layout version.

 

Like the old saying watch this space.

Link to comment
Share on other sites

Another go this is a bit ugly code mix of lisp & Vlisp that needs to be cleaned up but appears to work, so would appreciate someone testing it.Only works in Modelspace !

 

; Dim Reassociate 
; Thanks to Gile @ Theswamp for defuns to find vertex pts
; By BIGAL AUG 2014


(defun gc:GetClosestVertexTo (pl pt / pa)
 (setq	pa (vlax-curve-getParamAtPoint
     pl
     (vlax-curve-getClosestPointTo pl pt)
   )
 )
 (if (< (rem pa 1) 0.5)
   (vlax-curve-getPointAtParam pl (fix pa))
   (vlax-curve-getPointAtParam pl (1+ (fix pa)))
 )
)

(defun c:test (/ ss ss2 pt num num2 pt pt1 pt2 pt3 pl dimobj x y)

(setq oldsnap (getvar "osmode"))
(setvar "Osmode" 0) ; turn off all snaps

(setq maxd (getreal ("\nEnter max offset for search"))
; this is max distance for offset 

(princ "\nPick Lines etc")
(setq ss (ssget (list (cons 0  "Line,*polyline")))) ; pick plines etc

(princ "\nPick Dims etc")
(setq ss2 (ssget (list (cons 0 "Dimension")))) ; pick dims
; this can be done as 1 list but requires more coding
(setq num2 (sslength ss))
(setq num (sslength ss2))
(setq x 0)

(repeat num
(setq dimobj (entget (ssname ss2 x))) 
(setq dimobjvl (vlax-ename->vla-object (ssname ss2 x))) ; vl version of object
(setq pt (assoc 13 dimobj))
(setq pt (list (cadr pt)(caddr pt))) ; 1st insert pt

(setq pt1 (assoc 14 dimobj))
(setq pt1 (list (cadr pt1)(caddr pt1))) ;2nd insert pt

(setq y 0)

(repeat num2
(setq pl (vlax-ename->vla-object (ssname ss y))) 
(setq pt2 (gc:GetClosestVertexTo pl pt))
(if (< (distance pt2 pt) maxd)
(vla-put-ExtLine1Point dimobjvl (vlax-3d-point pt2))
; update node
(princ)
)
(setq pt3 (gc:GetClosestVertexTo pl pt1))
(if (< (distance pt3 pt1) maxd)
(vla-put-ExtLine2Point dimobjvl (vlax-3d-point pt3))
; update node
(princ)
)

(setq y (+ Y 1))
) ; repeat for objects

(setq x (+ x 1))
) ; repeat dims

(setvar "osmode" oldsnap")
 (princ)

) ;defun
(c:test)

Link to comment
Share on other sites

Another go this is a bit ugly code mix of lisp & Vlisp that needs to be cleaned up but appears to work, so would appreciate someone testing it.Only works in Modelspace !

 

:shock: Thanks BIGAL

 

WIll try this out tomorrow luch. Although not in paperspace but i will still test it out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...