HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

The zoom key scales both horizontally and vertically; how can one compress or expand in only one direction by a certain ratio?

2009-03-10View Original

Thread Content

The zoom key scales both horizontally and vertically; how can one compress or expand in only one direction by a certain ratio? Please advise, experts
Reply #22009-03-10
Stretch it, S. But I see my colleagues using it quite well; I find it not easy to use.
Reply #32009-03-10
Form it into a block, after which different scaling factors can be specified for its X, Y, and Z axes. After scaling, the blocks can be decomposed. The above operations can also be implemented through programming.
Reply #42009-03-10
Just stretch it directly – it’s the simplest way. 1. Type “S” on the keyboard and press Enter. 2. Hold down the left mouse button and select all the lines you want to stretch horizontally, vertically, or diagonally by moving from the bottom right to the top left, then press Enter. 3. Click to select the starting point for stretching, and then click the ending point. (The direction from the starting point to the ending point is the direction in which you want to stretch.) 4. That’s it. This post was last edited by tanmx on 2009-3-10 at 22:07
Reply #52009-03-11
Is the poster referring to the perspective or the command operations? If it’s a matter of perspective, only the z---w command can be used to obtain a relatively satisfactory view. If it’s a command, stretching is very useful, especially towards the end when the drawing becomes very complex. Of course, Lisp files with different scaling ratios are also used; they can be downloaded from the Xiaodong forum.
Reply #62009-03-11
Stretching can only occur from one cross-section; the ratio on either side of the cross-section remains unchanged. It’s better to create a block and adjust the X and Y axis ratios. After carefully considering what the original poster meant, it seems they are referring to scaling the display, rather than scaling the actual graphic. There’s nothing that can be done about this. This post was last edited by oylhupo on 2009-3-11 08:47]
Reply #72009-03-11
The following are general functions, which need to be loaded before using the above program;;; ;;;Personal general functions;;; ;;; ;;; ;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----Global variables---- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (VL-LOAD-COM) ;;;Load ActiveX (setq vlaxDoc(vla-get-ActiveDocument (vlax-get-Acad-Object) ) * ModelSpace * (vla-get-ModelSpace vlaxDoc) ) ;;;Get the model space pointer (setq n_lst(list "")) (setq olderr * error * ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;Program initial and end settings (defun hb_start (lst is /) (if is (progn (vla-StartUndoMark vlaxDoc) (setq n_lst(HB_SETVAR lst)) (setq * error * hb_error) ) (progn (setq * error * older) (HB_SETVAR n_lst) (vla-EndUndoMark VLAXDOC) ) ) ) ;;;Customized error function (defun hb_error (a /) (if (not (member a '("Function canceled" "Function canceled" "quit / e * t abort"))) (princ a) ) (if m_redraw (progn (redraw m_reDraw 4) (setq m_reDraw nil) ) ) (if m_delss (progn (vl-cmdf "_.erase" m_delss "") (setq m_delss nil) ) ) (HB_SETVAR n_lst) (setq * error * olderr) (vla-EndUndoMark VLAXDOC) ) ;;;Convert three-dimensional point to two-dimensional point (defun hb_3dpto2dp (point / rel) (list (car point) (cadr point)) ) ;;;Get the angle of the current UCS relative to the WCS (defun hb_ucsAng (/ rel) (ANGLE (trans '(0 0) 1 0) (trans '(1 0) 1 0)) ) ;;;Convert degrees to radians (defun hb_duToHu (du) ( * pi (/ du 180.0))) ;;;Convert radians to degrees (defun hb_HuToDu (hu) ( * 180 (/ hu pi))) ;;;Convert the table to an array containing double-precision real numbers (defun hb_ltoa (ptsList / arraySpace sArray) ; Allocate space for a two-dimensional point array represented as a double-precision real number (setq arraySpace (vlax-make-safearray vlax-vbdouble ; element type (cons 0 (- (length ptsList) 1) ) ; array dimension) ) (setq sArray (vlax-safearray-fill arraySpace ptsList)) ; Return array variant (vlax-make-variant sArray) ) ;;;Use ActiveX to draw polylines (defun hb_drawPL (plst / n point dp) (setq n 0) (repeat (length plst) (setq point (nth n plst) point (HB_3DPTO2DP (trans point 1 0)) dp (append dp point) ) (setq n (+ n 1)) ) (setq dp (HB_LTOA dp)) (vla-AddLightWeightPolyline * MODELSPACE * dp ) ) ;;;registry operation function (defun hb_Reg (lst keyWz isRead / key mykey n na rd rel) (setq key (vlax-product-key) mykey (strcat "HKEY_CURRENT_USER\\" key "\\HbSet\\" keyWz) ) (setq n 0) (if isRead (repeat (length lst) (setq na (nth n lst)) (setq rd (VL-REGISTRY-READ mykey (car na))) (if rd (setq rel (cons (cons (car na) rd) rel)) (setq rel (cons na rel)) ) (setq n (+ n 1)) ) (repeat (length lst) (setq na (nth n lst)) (VL-REGISTRY-WRITE mykey (car na) (cdr na)) (setq n (+ n 1)) ) ) rel ) ;;;Set system variables (defun hb_setVar (lst / n na rel) (if lst (progn (setq n 0) (repeat (length lst) (setq na (nth n lst)) (setq rel (cons (cons (car na) (getvar (car na))) rel)) (setvar (car na) (cdr na)) (setq n (+ n 1)) ) ) ) ;;;Get system variables (defun hb_getVar (lst / n na rel) (if lst (progn (setq n 0) (repeat (length lst) (setq na (nth n lst)) (setq rel (cons (cons na (getvar na)) rel)) (setq n (+ n 1)) ) ) ) rel ) ;;;Calculate midpoint (defun hb_zhongDian(dian1 dian2 / ax ay) (setq ax (- (car dian2) (car dian1)) ay (- (cadr dian2) (cadr dian1)) ) (list (+ (car dian1) (/ ax 2)) (+ (cadr dian1) (/ ay 2))) ) ;;; Get the number in a string (defun hb_getShuzi (str / sz n len tmp cha isdian rel) (if str (progn (setq sz "1234567890.") (setq n 1) (setq len (strlen str)) (repeat len (setq cha (substr str n 1)) (if (VL-STRING-SEARCH cha sz) (progn (if (= cha ".") (if isdian (setq cha "") (setq isdian t) ) ) (if tmp (setq tmp (strcat tmp cha)) (setq tmp cha) ) ) ) (setq n (1+ n)) ) ) ) (setq rel tmp) ) ;;;Get the data list from the selection set (defun hb_getShuju (ss lst / mn tmp tmp0 rel na ent a0) (setq n 0) (repeat (sslength ss) (setq na (ssname ss n) ent (entget na) ) (setq m (length lst)) (repeat (length lst) (setq m (- m 1)) (setq a0 (cdr (assoc (nth m lst) ent))) (if (not tmp) (setq tmp (list a0)) (setq tmp (append (list a0) tmp)) ) ) (if (not rel) (setq rel (list tmp)) (setq rel (cons tmp rel)) ) (setq tmp nil) (setq n (+ n 1)) ) rel ) (defun hb_getNameText (na / rel ent lx lst) (setq lst '("TEXT" "MTEXT" "ATTDEF" ));;"ATTRIB" "INSERT")) (setq ent (entget na) lx (cdr (assoc 0 ent)) ) (if (member lx lst) (setq rel (cdr (assoc 1 ent))) ) rel ) ;;;Get text information in the target (defun hb_getText (msg / sel rel ent lx tmp lst i) (setq lst '("TEXT" "MTEXT" "ATTDEF" "ATTRIB" "INSERT") ) (while (not i) (setq sel (car (entsel msg))) (if sel (progn (setq ent (entget sel) lx (cdr (assoc 0 ent)) ) (setq i (member lx lst)) (if (not i) (princ "The selected target does not contain valid information! ") ) ) (princ msg) ) ) (if (or (= lx "TEXT") (= lx "MTEXT") (= lx "ATTDEF") (= lx "ATTRIB") ) (setq rel (cdr (assoc 1 ent))) ) (if (and (= lx "INSERT") (= (cdr (assoc 66 ent)) 1)) (setq tmp (acet-insert-attrib-get (list sel 1)) rel (nth 1 (nth 0 tmp)) ) ) rel ) (defun hb_tableList (na is / rel tmp i) (setq rel (list (cdr (assoc 2 (tblnext na t))))) (while (not i) (setq tmp (cdr (assoc 2 (tblnext na)))) (if tmp (if is (if (/= (substr tmp 1 1) " * ") (setq rel (append rel (list tmp))) ) (setq rel (append rel (list tmp))) ) (setq it) ) ) rel ) (defun hb_addCons ( ent cns at / n rel nlt) (setq nlt (length ent)) (setq n (- nlt 1)) (if (> nlt at) (repeat nlt (setq rel(cons (nth n ent) rel)) (if (= n at) (setq rel (cons cns rel)) ) (setq n (1- n)) ) (progn (setq rel (cons cns rel)) (repeat nlt (setq rel(cons (nth n ent) rel)) (setq n (1- n)) ) ) ) rel ) (defun hb_getEntCount(ent ename / tmp n rel cns) (foreach cns ent (if (= (car cns) ename) (progn (setq tmp (cdr cns)) (setq rel (cons tmp rel)) ) ) ) (reverse rel) ) (defun hb_list_fanXu(ent / rel tmp n len) (setq n 0) (repeat (length ent) (setq tmp(nth n ent) rel(cons tmp rel) n (1+ n) ) ) rel ) (defun hb_list_enaDel(lst ena / tmp rel) (foreach tmp lst (if (/= (car tmp) ena) (setq rel (cons tmp rel)) ) ) (reverse rel) ) (defun hb_list_replaceAt(lst nitem at / tmp rel n) (setq n 0) (repeat (length lst) (setq tmp(nth n lst)) (if (= n at) (setq rel (cons nitem rel)) (setq rel (cons tmp rel)) ) (setq n(1+ n)) ) (reverse rel) ) (defun hb_list_delAt(lst at / tmp rel n) (setq n 0) (repeat (length lst) (setq tmp(nth n lst)) (if (/= n at) (setq rel(cons tmp rel)) ) (setq n(1+ n)) ) (REVERSE rel) ) (defun hb_list_replaceEnt(ent lst / tmp) (foreach tmp lst (if (assoc (car tmp) ent) (setq ent(subst tmp (assoc (car tmp) ent) ent)) (setq ent (REVERSE ent) ent (cons tmp ent) ent (REVERSE ent)) ) ) ent ) (defun hb_list_replaceFor(lst newlst cns / tmp rel n) (setq n 0) (foreach tmp lst (if (= (car tmp) cns) (setq rel (cons (cons cns (nth n newlst)) rel) n (1+ n) ) (setq rel (cons tmp rel)) ) ) (reverse rel) ) (defun hb_ss_copy (ss / rel tmp n) (setq n 0) (setq rel(ssadd)) (if ss (progn (repeat (sslength ss) (setq tmp (ssname ss n)) (ssadd tmp rel) (setq n(1+ n)) ) ) ) rel ) (defun hb_ssToLst (ss / na ent ena n rel) (setq n 0) (repeat (sslength ss) (setq na (ssname ss n) ent (entget na) ena (cdr (assoc -1 ent)) ) (setq rel (cons ena rel) n (1+ n) ) ) (reverse rel) ) (defun hb_ss_delByEnt (ss lst is / tmp n rel na ent tmpar tmpdr tmpent pd) (if ss (progn (setq rel (ssadd)) (setq n 0) (repeat (sslength ss) (setq na (ssname ss n) ent (entget na) pd t ) (foreach tmp lst (setq tmpar (car tmp) tmpdr (cdr tmp) ) (if (and (setq tmpent (assoc tmpar ent)) (WCMATCH (cdr tmpent) tmpdr)) () (setq pd nil) ) ) (if is (if (not pd) (ssadd na rel) ) (if pd (ssadd na rel) ) ) (setq n (1+ n)) ) ) ) rel ) (defun hb_dlg_image(key sldna / dimx dimy) (setq dimx(dimx_tile key) dimy(dimy_tile key)) (start_image key) (fill_image 0 0 dimx dimy 0) (slide_image 0 0 dimx dimy sldna) (end_image) ) (defun hb_get_entX(ent cnt / rel e ) (foreach e ent (if (= (car e) cnt) (setq rel(cons (cdr e) rel)) ) ) (reverse rel) ) (defun hb_get_SupDir (/ path n) (setq path (getvar "ACADPREFIX") n (VL-STRING-SEARCH ";" path) path (substr path 1 n) path (strcat path "\\") ) ) (defun hb_getFileDate (fna / rel tmp file) (if (setq file (open fna "r")) (progn (while (setq tmp (read-line file)) (setq rel (cons tmp rel)) ) (setq rel (reverse rel)) (close file) ) ) rel ) (defun hb_setMyVar (na vla / file path fna tmp str is rel wtvla sjlst n qm hm sj ) (setq path (HB_GET_SUPDIR) fna (strcat path " hb_var102.ini ") is t na (strcase na) wtvla (strcat na "=" vla) sjlst (HB_GETFILEDATE fna) n 0 ) (while (and is (< n (length sjlst))) (setq tmp (nth n sjlst)) (if (/= (substr tmp 1 1) ";") (if (setq sj (HB_STRING_BYCHAR tmp "=")) (progn (setq qm (strcase (car sj))) (if (= na qm) (setq sjlst (subst wtvla tmp sjlst) is nil rel (cdr sj) ) ) ) ) ) (setq n (1+ n)) ) (if is (setq sjlst (append sjlst (list wtvla))) (setq is t) ) (setq file (open fna "w")) (MAPCAR '(LAMBDA (itm) (write-line itm file)) sjlst ) (close file) rel ) (defun hb_getMyVar (na / file path fna tmp str is rel sj) (setq path (HB_GET_SUPDIR) fna (strcat path " hb_var102.ini ") is t na (strcase na) ) (if (setq file (open fna "r")) (progn (while (and is (setq tmp (read-line file))) (setq tmp (strcase tmp)) (if (/= (substr tmp 1 1) ";") (if (setq sj (HB_STRING_BYCHAR tmp "=")) (progn (setq qm (car sj) hm (cadr sj) ) (if (= na qm) (setq rel hm is nil ) ) ) ) ) (close file) ) ) rel ) (defun hb_string_byChar(str char / n lft rig rel) (if (setq n (VL-STRING-SEARCH "=" str)) (setq lft (substr str 1 n) rig (substr str (+ n 2) (- (strlen str) n 1)) rel (list lft rig) ) ) rel ) (defun hb_dlg_listAdd(key lst / ) (start_list key) (MAPCAR 'add_list lst) (end_list) ) (defun hb_dlg_start(dlgname dlg wz / rel dlgloaded dlgshow) (setq dlgloaded t dlgshow t) (if (null wz) (setq wz '(-1 -1)) ) (if (= -1 (setq rel(load_dialog dlgname))) (progn (princ (strcat "\n" dlgname "File cannot be loaded")) (setq dlgloaded nil rel nil) ) ) (if (and dlgloaded (not (new_dialog dlg rel "" wz))) (progn (princ "\nThe dialog box cannot be displayed") (setq dlgshow nil rel nil) ) ) rel ) (defun hb_txt_lstToStr (lst cha / rel) (setq rel "") (MAPCAR '(LAMBDA (itm) (setq rel (strcat rel itm cha))) lst ) (setq rel(substr rel 1 (- (strlen rel) 1))) ) (defun hb_txt_strToLst (str cha / rel) (while (setq n (VL-STRING-SEARCH cha str)) (setq rel (cons (substr str 1 n) rel) str (substr str (+ 2 n) (- (strlen str) n 1)) ) ) (REVERSE rel) ) (defun hb_getSysTime(wei / n) (setq rel (HB_* AOSHU (getvar "cdate") 8) n (VL-STRING-SEARCH "." rel) rel (substr rel (+ n 2) wei)) ) Bamboo rewards love coins: 20 by xyp1964
Reply #82009-03-11
It’s complex; I don’t know how to program. Once I see it, I’ll hurry to learn it in depth.*

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.