sarvo046 Posted April 7, 2012 Posted April 7, 2012 Hi ALL, I am new to this forum. Need desperate help from you guys. In a drawing file customer wants to create 2 title block. both the title blocks should be added to the same drawing. At any point of time only one should be visible to the user. Basically users in one country will see first title block and users in another country will see second title block. Is this posssible? if yes, what kind of efforts shuld I put to make this work? Alisp,Vlisp,ARX....? Quote
BlackBox Posted April 7, 2012 Posted April 7, 2012 Welcome to CADTutor! Why not simply create a dynamic title block (using the block editor) which has selectable visibility states (one for each country)? The only alternative that jumps out to me is to use some defined global variable (set by AcadDoc.lsp?), or registry key (set during IT setup), which identifies a user's computer by country code and the programmatically manipulates the Freeze / Thaw of respective country layers. HTH Quote
sarvo046 Posted April 7, 2012 Author Posted April 7, 2012 Thanks RenderMan. so you mean to say like, if dynamic block doesn't work, then some programs has to be written? The problem is same file will be used by customers in different country. so when they open file the drawing should be same irrespective of country, only the title block should be switched in accordance with the country. Quote
Tharwat Posted April 7, 2012 Posted April 7, 2012 This may work .... Change the TitleBlock1 to your real name of block and the second one as well also Titleblock2 , and the name of the username of your computer . (defun c:Test (/ selectionset increment selectionsetname)(vl-load-com) ;;; Tharwat 07. April. 2012 ;;; (if (eq (getenv "USERNAME") [color=red][b]"Tharwat"[/b][/color]) (if (setq selectionset (ssget "_x" '((0 . "INSERT") (2 .[b][color=blue] "TitleBlock1"[/color][/b])) ) ) (repeat (setq increment (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq increment (1- increment)) ) ) (vla-put-visible (vlax-ename->vla-object selectionsetname) :vlax-false ) ) ) (if (setq selectionset (ssget "_x" '((0 . "INSERT") (2 . [color=blue][b]"TitleBlock2"[/b][/color])) ) ) (repeat (setq increment (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq increment (1- increment)) ) ) (vla-put-visible (vlax-ename->vla-object selectionsetname) :vlax-true ) ) ) ) (princ) ) Quote
BlackBox Posted April 7, 2012 Posted April 7, 2012 Thanks RenderMan.so you mean to say like, if dynamic block doesn't work, then some programs has to be written? The problem is same file will be used by customers in different country. so when they open file the drawing should be same irrespective of country, only the title block should be switched in accordance with the country. Using a dynamic block solves your problem by making both title blocks available within one, single block that the customer can then manipulate to suite their country. However, this can be more challenging to manipulate with code, if you are not adept at manipulating visibility states, and dealing with anonymous blocks. Unfortunately, you're dealing with customers. One generally cannot relegate customers to one's own standards easily, and must consider that most customers want to do things their way. Consider providing options to customers which allow the flexibility to do provide the functionality you seek, while not interfering with the customer's setup. One option is to provide a simple CUI(x) which makes available a Menu, or Ribbon button that can then be integrated into a customer's workspace. Simply include the LISP that you require within .mnl and this code will be loaded at startup when .cui(x) is loaded. A potentially simpler option, is to place each countries title block on a unique layer within the title block itself, and then programmatically (upon drawing open) Freeze all country layers that are not applicable, and ensure that the country layer that does apply is thawed. This requires a system for the code to determine which country the end-user is a member of without user input (more than once). ... Does this make sense? This may work .... Change the TitleBlock1 to your real name of block and the second one as well also Titleblock2 , and the name of the username of your computer . I would not provide code to customers that require the customer to modify the source code for each user. This can be extremely problematic, and lead to the customer forming a negative opinion of you, or your employer. Use internally could also become problematic, and should be well tested prior to distribution to end-user setups IMO. Quote
Lee Mac Posted April 8, 2012 Posted April 8, 2012 A potentially simpler option, is to place each countries title block on a unique layer within the title block itself, and then programmatically (upon drawing open) Freeze all country layers that are not applicable, and ensure that the country layer that does apply is thawed. I was also about to suggest using frozen layers, but I see no need for programming in this respect - surely the user can freeze/thaw the necessary layers before sending the drawings to the client? Quote
BlackBox Posted April 9, 2012 Posted April 9, 2012 I would have to agree... The part that makes me question this is the line that mentions that the same file will be used in different countries. More information is needed. 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.