soham Posted November 7, 2014 Share Posted November 7, 2014 (edited) Hello sir, I am working on lisp in which I need your kind help. Right now, I want to get the dimension of a component already available in 3D in AutoCAD. For example, I have 3D drawing of component of 100x100x10 . I am stucked at this point. Please help me. Thanking You, Edited February 20, 2015 by soham Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 7, 2014 Share Posted November 7, 2014 Soham, are your 3D parts always like box 3DSOLID? You can get it's bounding box point coordinates and calculate its height... The easiest way if 3DSOLIDs are ordinary primitives not created after solid modeling operations like (union, subtract, intersect) to try this explained in this post : http://www.cadtutor.net/forum/showthread.php?89522-Change-surface-build-settings-via-lisp&p=#6& HTH Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 8, 2014 Share Posted November 8, 2014 You've made subtraction in your main 3DSOLID, so my link isn't applicable as 3DSOLID lost its primitive properties... You'll have to go another way : (defun c:solhig ( / ss solobj ll ur hig ) (vl-load-com) (prompt "\nPick 3D SOLID") (setq ss (ssget "_+.:E:S" '((0 . "3DSOLID")))) (while (null ss) (prompt "\nEmpty sel.set... Please try picking 3D SOLID again...") (setq ss (ssget "_+.:E:S" '((0 . "3DSOLID")))) ) (setq solobj (vlax-ename->vla-object (ssname ss 0))) (vla-getboundingbox solobj 'll 'ur) (setq ll (vlax-safearray->list ll)) (setq ur (vlax-safearray->list ur)) (setq hig (abs (- (caddr ur) (caddr ll)))) (prompt "\nHeight of picked 3D SOLID is : ") (princ (rtos hig 2 50)) (princ) ) Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 12, 2014 Share Posted November 12, 2014 soham: It is not necessary to repeat a question in the same thread in back-to-back posts. Please show some patience. It also is not necessary to repeat the same question in multiple threads as it makes it difficult to follow the course of any discussion when posts are spread over two or more unrelated threads. Thank you. Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 12, 2014 Share Posted November 12, 2014 You'll just have to be patient. Those of us who choose to respond to questions here are merely volunteering our time, services and talents; we are not paid staff. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 12, 2014 Share Posted November 12, 2014 (edited) And who will delete those posts... soham, try this code and let me know if it satisfies your needs... If that's true, please delete sufficient posts... (defun c:promptdims ( / *error* incrementalpha x ss i dim value ) (defun *error* ( msg ) (if msg (prompt msg)) (princ) ) (defun incrementalpha ( str inc / _incrementalpha a ) (defun _incrementalpha ( a b / c d e ) (cond ( (cond ( (< 47 (setq c (car a)) 58) (setq d 48 e 10 ) ) ( (< 64 c 91) (setq d 65 e 26 ) ) ( (< 96 c 123) (setq d 97 e 26 ) ) ) (setq c (+ (- c d) b) b (/ c e) ) (cons (+ d (rem c e)) (if (zerop b) (cdr a) (if (cdr a) (_incrementalpha (cdr a) b) (_incrementalpha (list d) (if (= 10 e) b (1- b))) ) ) ) ) ( (cons c (if (cdr a) (_incrementalpha (cdr a) b) (_incrementalpha (list 65) (1- b)) ) ) ) ) ) (vl-list->string (reverse (if (setq a (reverse (vl-string->list str))) (_incrementalpha a inc) (_incrementalpha '(65) (1- inc)) ) ) ) ) (defun getdimmtxtvalue ( dim / e txt ) (setq e (entlast)) (command "_.EXPLODE" dim) (while (> (getvar 'cmdactive) 0) (command "")) (while (/= (cdr (assoc 0 (entget (setq e (entnext e))))) "MTEXT")) (setq txt (cdr (assoc 1 (entget e)))) (command "_.UNDO" "") (setq txt (substr txt (+ 2 (vl-string-search ";" txt)))) txt ) (setq x "a") (prompt "\nSelect DIMENSION entities in desired order...") (setq ss (ssget "_:L" '((0 . "DIMENSION")))) (while (null ss) (prompt "\nEmpty sel.set... Please try selecting DIMENSION entities in desired order again...") (setq ss (ssget "_:L" '((0 . "DIMENSION")))) ) (setq i -1) (repeat (sslength ss) (setq dim (ssname ss (setq i (1+ i)))) (setq value (getdimmtxtvalue dim)) (princ (strcat "\n" x "=" value)) (setq x (incrementalpha x 1)) ) (*error* nil) ) Of course, say thanks to Mr. Lee Mac for his subfunction (incrementalpha)... M.R. Edited November 12, 2014 by marko_ribar Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 12, 2014 Share Posted November 12, 2014 I moved related posts to AutoLISP, Visual LISP & DCL > Program to Compute thickness automatically using AutoLISP Please stop adding to unrelated threads. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 12, 2014 Share Posted November 12, 2014 Thank you SLW210... M.R. Quote Link to comment Share on other sites More sharing options...
AIberto Posted November 12, 2014 Share Posted November 12, 2014 I moved related posts to AutoLISP, Visual LISP & DCL > Program to Compute thickness automatically using AutoLISP Please stop adding to unrelated threads. Thank you! Hulk:lol: You are a responsible administrator !great job! Quote Link to comment Share on other sites More sharing options...
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.