haisagiviz Posted June 6, 2019 Posted June 6, 2019 Hi everyone, Please help me how to create 2 selection set (one of "MTEXT" and one of "DIMENSION") from this code I made. (setq ss3 (ssget ":L" '((0 . "MTEXT,DIMENSION")))) Thank you so much. Quote
Lee Mac Posted June 6, 2019 Posted June 6, 2019 (edited) Assuming that you only wish to prompt the user once for an initial selection containing both types of object, you would then need to iterate over the selection and separate the entities into two selection sets based on their entity type, for example: (defun c:test ( / dss ent idx mss ) (if (setq mss (ssget "_:L" '((0 . "MTEXT,*DIMENSION")))) (progn (setq dss (ssadd)) (repeat (setq idx (sslength mss)) (setq idx (1- idx) ent (ssname mss idx) ) (if (/= (cdr (assoc 0 (entget ent))) "MTEXT") (progn (ssdel ent mss) (ssadd ent dss) ) ) ) (princ (strcat "\nSelect contained " (itoa (sslength mss)) " MText and " (itoa (sslength dss)) " Dimensions." ) ) ) ) (princ) ) Edited June 6, 2019 by Lee Mac 1 Quote
haisagiviz Posted June 6, 2019 Author Posted June 6, 2019 Hi Lee Mac, Thank you so much. You are always be my idols ^^ Sorry but I tested and nil for result. Please help me about that. Command: test Select objects: Specify opposite corner: 13 found Select objects: Error: bad argument type: numberp: nil Best regards, Quote
Lee Mac Posted June 6, 2019 Posted June 6, 2019 41 minutes ago, haisagiviz said: Hi Lee Mac, Thank you so much. You are always be my idols ^^ Sorry but I tested and nil for result. Please help me about that. Command: test Select objects: Specify opposite corner: 13 found Select objects: Error: bad argument type: numberp: nil Best regards, Thank you for your kind words. Are you testing the code exactly as posted? As I cannot seem to replicate the issue you are encountering and see no reason for this error. Lee Quote
haisagiviz Posted June 6, 2019 Author Posted June 6, 2019 I'm sure I copy exactly as posted because I understood how it work. But I cannot realize where the error is. P/S: If you have time, could you please help me see the attached DWG file's dimension issue. It is my big problem for now. I exported DWG from 3D BIM software and the dimension is not correct as AutoCAD system block and have ugly error when modify anything (such as move, change color, layer...) -> For now I can create a routine with function is filter all dimension I choose and change to other style (have no ugly error) and move all of ref point of dimension to base line (like as No ext line). But one more case I cannot handle is Dimension with Ext line length is custom by BIM software and not be correct understand in AutoCAD. My hope: Can you give me any idea or solution to explode only current Ext line with length of Dimension and without explode the dimension. Like extract Ext line from Dimension. Thank for your time to help everyone and me. HAI Dimension Issue.dwg Quote
Roy_043 Posted June 6, 2019 Posted June 6, 2019 (edited) I suspect that there is indeed an issue with how @haisagiviz copies code. Maybe this is due to an online translator? Or maybe the code is not saved to a plain text file? In another topic I ended up attaching a Lisp file. Edited June 6, 2019 by Roy_043 1 Quote
Lee Mac Posted June 6, 2019 Posted June 6, 2019 (edited) I think you're probably right Roy; I've also noticed that copying code from the forum can occasionally include invisible characters which appear as part of the code (usually at the end), which are then rendered as question marks in the IDE - I think these are caused by the 'Quote selection' link which appears. @haisagiviz Your subsequent question belongs in a separate thread. Edited June 6, 2019 by Lee Mac 1 Quote
haisagiviz Posted June 6, 2019 Author Posted June 6, 2019 (edited) Very thank you Roy and Lee Mac, BTW I will type again from plain text. It is worked for me (Maybe error when copy from browser as Roy said) I understood how to filter my selection set. Thank you very much. Edited June 6, 2019 by haisagiviz Quote
Lee Mac Posted June 7, 2019 Posted June 7, 2019 You're welcome @haisagiviz - I'm glad the code is now working for you. 1 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.