Costinbos77 Posted November 5, 2012 Posted November 5, 2012 Hello ! I change more properties to a layer with (vla-put-LayerOn obj :vlax-true) , (vla-put-Freeze obj :vlax-false) bat don’t actualized the drawing . I try with : (vla-regen (vla-get-activeDocument (vlax-get-acad-object)) acAllViewports) bat no any changes . Any ideas ? Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 If I got your point correctly , You need to use entupd function for every entity name that the objects were on these layers . Quote
Costinbos77 Posted November 5, 2012 Author Posted November 5, 2012 No, I modify only layer property : on or off . Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 That happen when you freeze and unfreeze layers . Try to move to any layout tab and go back to Model and you will find out that all objects are appeared . Quote
Costinbos77 Posted November 5, 2012 Author Posted November 5, 2012 (edited) (vlax-for obj (vla-get-Layers oacd) (if (member (vla-get-Name obj) lStrat) (progn (vla-put-LayerOn obj :vlax-true) (vla-put-Freeze obj :vlax-false) ) (progn (vla-put-LayerOn obj :vlax-false) ) ) ;_ end of if ) ;_ end of vlax ...... (vla-regen oacd acAllViewports) It’s a modality to do that , bat I need a program line . I ask if anybody know a vl function or adder method like (vla-regen x) which help me in regenerate appearance of drawing objects. Edited November 6, 2012 by Costinbos77 Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 I don't think that there is a function to do that other than entupd function , but anyway now , can you post the list of the variable ( lStrat ) ? Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 Suppose that your list of layer names is (list "0" "one" "two" "three") as shown in the following code . [uNTESTED] (mapcar '(lambda (x) (setq lst (cons (strcat x ",") lst ))) (list "0" "one" "two" "three")) (if (setq s (ssget "_x" (list (cons 8 (vl-string-right-trim "," (apply 'strcat lst)))))) (repeat (setq i (sslength s)) (entupd (ssname s (setq i (1+ i)))) ) ) Quote
SLW210 Posted November 5, 2012 Posted November 5, 2012 Please read the CODE POSTING GUIDELINES and add Code Tags to your code. Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 Ai postat ceva? a dat eroare. Mai incearca. You're in an English forum here . Quote
SLW210 Posted November 5, 2012 Posted November 5, 2012 Ai postat ceva? a dat eroare. Mai incearca. I translated to this.. You posted something? gave error. More tries. Quote
Tharwat Posted November 5, 2012 Posted November 5, 2012 I translated to this.. yeah , I have translated the same but I think the OP should re-read the post once again , and that post in their language shows that they were in a hurry which caused them not to understand the code very well . Quote
Costinbos77 Posted November 6, 2012 Author Posted November 6, 2012 Hello again! Hurrying very hard and I posted that message because it was sent to someone who understood what I wrote. Quote
Costinbos77 Posted November 6, 2012 Author Posted November 6, 2012 Returning to the initial problem is a good solution that I thought not. Another way would be to change the current layer, possibly to "0". But these solutions avoid the problem, not solve it. The question is: what happens when the switch between model space and paper (Layouts)? This "regeneration" or "redraw" is the answer. Quote
Stefan BMR Posted November 6, 2012 Posted November 6, 2012 Costin, If you are talking to me, I must say that "Code removed, Bad interpretation" is not an error (not in the way you thought it is). I just misunderstood your request and I removed the code. Back to your problem, I can not reproduce the behavior you described. Are you sure is just a regeneration problem, or there is an error message? Something like ; error: Automation Error. Invalid layer This is the message you'll get if you try vla-put-freeze on current layer, no matter if it is :vlax-true or :vlax-false. You can try the native commands _layon and _laythw, then turn off layers that are not in lStrat list. Stefan Quote
Costinbos77 Posted November 6, 2012 Author Posted November 6, 2012 (edited) For Stefan. Sorry, I did not read carefully, I now understand what it was about. I try to make a program to fit properties in layers of drawing 1 to drawing 2. It is easier to take and process layers with : [font=Times New Roman][size=3](vlax-for obj (vla-get-Layers (vla-get-ActiveDocument Acad-Obj))[/size][/font] [size=3][font=Times New Roman](if (and (= (vla-get-LayerOn obj) :vlax-true) (= (vla-get-Freeze obj) :vlax-false)) [/font][/size] [size=3][font=Times New Roman] (setq ll1 (cons obj ll1) lStrat (cons (vla-get-Name obj) lStrat)) ;_ end of setq[/font][/size] [size=3][font=Times New Roman]) ;_ end of if[/font][/size] [size=3][font=Times New Roman] ) ;_ end of vlax[/font][/size] Launch is from drawing 1 and drawing 2 changes. It is difficult to send in drawing 2 [font=Times New Roman][size=3](vla-SendCommand vgad (strcat "(command \"_layoff\" strat \"\")") )[/size][/font] similar with command in Active Document [size=3][font=Times New Roman](command "_layoff" strat "")[/font][/size] [size=3][font=Times New Roman](vlax-for obj (vla-get-Layers oacd)[/font][/size] [size=3][font=Times New Roman] (if (member (vla-get-Name obj) lStrat)[/font][/size] [size=3][font=Times New Roman] (Prognos (vla-put-LayerOn obj: vlax-true) (vla-put-Freeze obj: vlax-false))[/font][/size] [size=3][font=Times New Roman] (Prognos (vla-put-LayerOn obj: vlax-false))[/font][/size] [size=3][font=Times New Roman] ) _ End of if[/font][/size] [size=3][font=Times New Roman] ) _ End of vlax[/font][/size] But no visible changes occurred without any intervention on drawing 2: setting or changing layer between model space and paper space or another. Looking for a solution to avoid manual settings made. But no visible changes occurred without any intervention on drawing 2: setting or changing layer between model space and paper space or another. Looking for a solution to avoid manual settings made I think there must be something like: [font=Arial][color=#333333](command "REGEN")[/color][/font] or lisp function entmod entupd used. What do vla-update? Edited November 6, 2012 by Costinbos77 Quote
SLW210 Posted November 6, 2012 Posted November 6, 2012 Please read the CODE POSTING GUIDELINES and add Code Tags to your code. Please edit your post to include all code and code snippets in CODE TAGS. Quote
Costinbos77 Posted November 7, 2012 Author Posted November 7, 2012 I noticed that after I run the application lisp, (defun C:PotrStr () ; 1 . 11 . 2012 . (setq lStrat nil ll1 nil *error* nil) ;_ end of setq layon (vlax-for obj (vla-get-Layers (vla-get-ActiveDocument Acad-Obj)) (if (and (= (vla-get-LayerOn obj) :vlax-true) (= (vla-get-Freeze obj) :vlax-false)) (setq ll1 (cons obj ll1) lStrat (cons (vla-get-Name obj) lStrat)) ;_ end of setq ) ;_ end of if ) ;_ end of vlax (if lStrat (progn (setq lStrat (vl-sort lStrat '<) llStrat (length lStrat) ) ;_ end of setq (setq acDocs (vla-get-Documents Acad-Obj) activ (vla-get-ActiveDocument Acad-Obj) lacobj nil tacobj "" i 0) ;_ end of setq (vla-get-Count acDocs) ; Nr Obiecte Deschise ! (vl-propagate 'activ) (vlax-for obj acDocs (setq i (1+ i) nmdwg (vla-get-FullName obj) lacobj (cons nmdwg lacobj) tacobj (strcat tacobj "\n " (itoa i) " : " nmdwg " ;") ) ) ;_ end of vlax (textscr) (if (= (setq codoc (getstring (strcat "\n ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---" tacobj "\n Drawing for Processing : Enter = Choose DWG : ")) ) "") (progn ; then ;;; (command "_.OPEN" "d:\\drawings\\mydrawing.dwg") (setq calew (getfiled " ! File D W G pentru PRELUCRARE ! " (if dwgn (vl-filename-directory dwgn) acdp) "DWG;*" 4) oacd (vla-open acDocs calew) ) ;_ end of setq ) ;_ end of then (progn (setq oacd (vla-item acDocs (1- (atoi codoc))) ) ;_ end of setq ;;; (vla-Activate oacd) ) ) ;_ end of if = (graphscr) ; Reinitializare (vlax-for obj (vla-get-Layers oacd) (if (member (vla-get-Name obj) lStrat) (progn (vla-put-LayerOn obj :vlax-true) (vla-put-Freeze obj :vlax-false) ) (progn (vla-put-LayerOn obj :vlax-false) ) ) ;_ end of if ;;; (vla-update obj) ) ;_ end of vlax (vla-regen oacd acAllViewports) ; acActiveViewport ;;; (vla-update oacd) ) ;_ end of prog then (alert "Lista cu Straturi Este GOALA !" ) ) ;_ end of if ltent ) ;_ end of defun C:PotrStr ! the processed drawing file close, do not ask me to save. This means that AutoCAD do not see changes made. Maybe that's why it can not regenerate anything. An opinion? Costin Quote
Costinbos77 Posted November 15, 2012 Author Posted November 15, 2012 So it realized the variable "lStrat" : (setq [color=red]lStrat[/color] nil ll1 nil ) ;_ end of setq (setq Acad-Obj (vlax-get-acad-object) MSpace (vla-get-ModelSpace (vla-get-ActiveDocument Acad-Obj)) ) So it realized the variable "lStrat" (vlax-for obj (vla-get-Layers (vla-get-ActiveDocument Acad-Obj)) (if (and (= (vla-get-LayerOn obj) :vlax-true) (= (vla-get-Freeze obj) :vlax-false)) (setq ll1 (cons obj ll1) [color=red]lStrat[/color] (cons (vla-get-Name obj) lStrat)) ;_ end of setq ) ;_ end of if ) ;_ end of vlax Quote
Recommended Posts
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.