Jump to content

Offset lines create diffrent layers and specify offset distence


Recommended Posts

Posted

1. In utilities need offset the line 2m. and 1.5m and 4m….etc.

Every line create the new layer (new layer name user defined ) no need color.

2. the layer name I defined as the line type

Example:- layer name: MV Electrical (---MV Electrical---MV Electrical---MV Electrical---MV Electrical---)

And how much distance between the text also user defined

No need line between text to text

 

Thanks

I am sorry for my poor English

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • satishrajdev

    11

  • 121madhu

    7

  • Tharwat

    4

  • BIGAL

    2

Top Posters In This Topic

Posted Images

Posted

Please post a example dwg or image.

 

To have different spacing of the text would mean that it is not a line type but text and lines, you can though create the smae linetype many times with different text spacing.

 

*WATER_MAIN,Water main ----W----W----W----W----W----W--

A,40,-4.0,["W",STANDARD,S=1.8,R=0.0,X=-1.8,Y=-2.0],-4

*WATER_MAIN2,Water main2 ----W----W----W----W----W----W--

A,20,-5.08,["W",STANDARD,S=1.8,R=0.0,X=-1.8,Y=-.9],-3

Posted

TRY THIS :-

 

*Give offset distance in + or - according to your offset direction.

(DEFUN C:TEST (/ A B C)
 (VL-LOAD-COM)
 (WHILE
   (SETQ A (GETSTRING "\nSpecify Name of New Layer :"))
    (SETQ B (CAR (ENTSEL "\nSelect Line to Offset :")))
    (INITGET 1)
    (SETQ C (GETDIST "\nSpecify Offset Distance :"))
    (VLA-ADD (VLA-GET-LAYERS
       (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
         )
         A
    )
    (VLA-OFFSET
      (VLAX-ENAME->VLA-OBJECT B)
      C
    )
    (VLA-PUT-LAYER (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)
 )
 (PRINC)
)

Posted

Satish , do you know that the getstring function with enter means not nil value ?

Posted

Oops... i didnt realise that.... how to avoid that Tharwat

Posted
Oops... i didnt realise that.... how to avoid that Tharwat

 

You can add the operator (not equal to [/=] or (not (eq .....))) to avoid THAT. ;)

Posted

SOMETHING LIKE THIS ????

 

(DEFUN C:TEST (/ A B C)
 (VL-LOAD-COM)
 (WHILE
   (WHILE (OR (= A NIL) (= A ""))
     (SETQ A (GETSTRING "\nSpecify Name of New Layer :"))
   )
    (SETQ B (CAR (ENTSEL "\nSelect Line to Offset :")))
    (INITGET 1)
    (SETQ C (GETDIST "\nSpecify Offset Distance :"))
    (VLA-ADD (VLA-GET-LAYERS
	(VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
      )
      A
    )
    (VLA-OFFSET
      (VLAX-ENAME->VLA-OBJECT B)
      C
    )
    (VLA-PUT-LAYER (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)
 )
 (PRINC)
)

Posted

SOMETHING LIKE THIS ????

 

(DEFUN C:TEST (/ A B C)
 (VL-LOAD-COM)
 (WHILE
   (WHILE (OR (= A NIL) (= A ""))
     (SETQ A (GETSTRING "\nSpecify Name of New Layer :"))
   )
    (SETQ B (CAR (ENTSEL "\nSelect Line to Offset :")))
    (INITGET 1)
    (SETQ C (GETDIST "\nSpecify Offset Distance :"))
    (VLA-ADD (VLA-GET-LAYERS
	(VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
      )
      A
    )
    (VLA-OFFSET
      (VLAX-ENAME->VLA-OBJECT B)
      C
    )
    (VLA-PUT-LAYER (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)
 )
 (PRINC)
)

Posted

This is enough ...

(while  (/= (setq A (getstring "\n Specify Name of New Layer :")) "")
 .....

Posted

thank you satish & tharwat

my request specify which side offset and continue this lisp when i press Esc.

 

another one is line type

Posted

Your welcome,

But I didn't get what you said next, what you want to do exactly....specify clearly or give example

Posted

Try this :-

(DEFUN C:TEST (/ A B C D)
 (VL-LOAD-COM)
 (WHILE (/= (SETQ A (getstring "\nSpecify Name of New Layer :")) "")
   (SETQ B (CAR (ENTSEL "\nSelect Line to Offset :")))
   (INITGET 1)
   (SETQ C (GETDIST "\nSpecify Offset Distance :"))
   (SETQ D (GETPOINT "\nSpecify Point on Side to Offset :"))
   (VLA-ADD (VLA-GET-LAYERS
          (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
        )
        A
   )
   (VLA-OFFSET
     (VLAX-ENAME->VLA-OBJECT B)
     (POINTSIDE B D)
   )
   (VLA-PUT-LAYER (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)
 )
 (PRINC)
)

(DEFUN POINTSIDE (OBJ PNT / P1 PA P2)
 (SETQ    P1 (VLAX-CURVE-GETCLOSESTPOINTTO OBJ (TRANS PNT 1 0))
   PA (VLAX-CURVE-GETPARAMATPOINT OBJ P1)
 )
 (IF (EQUAL '(0.0 0.0 0.0)
        (VLAX-CURVE-GETSECONDDERIV OBJ PA)
        1e-8
     )
   (SETQ P1 (VLAX-CURVE-GETPOINTATPARAM OBJ (FIX PA))
     P2 (VLAX-CURVE-GETPOINTATPARAM OBJ (1+ (FIX PA)))
   )
   (SETQ P2 (MAPCAR '+ P1 (VLAX-CURVE-GETFIRSTDERIV OBJ PA)))
 )
 (IF (MINUSP (SIN (- (ANGLE P1 PNT) (ANGLE P2 PNT))))
   (SETQ C (- C))
   (SETQ C (+ C))
 )
)

Posted

yes i am looking this its works perfect

thank you very much satish.

 

i am create this line-type and loaded

*TELECOMLINE,TELECOM TELECOM TELECOM TELECOM TELECOM TELECOM TELECOM

A,.1,-.1,["TELECOM",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*SPARE_LINE,SPARE line ----SPARE----SPARE----SPARE----SPARE----SPARE----SPARE--

A,.1,-.1,["SPARE",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*STORM WATER_LINE,STORM WATER line ----STORM WATER----STORM WATER----STORM WATER----STORM WATER----STORM WATER----STORM WATER--

A,.1,-.1,["STORM WATER",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*MV ELECTRICAL_LINE,MV ELECTRICAL line ----MV ELECTRICAL----MV ELECTRICAL----MV ELECTRICAL----MV ELECTRICAL----MV ELECTRICAL----MV ELECTRICAL--

A,.1,-.1,["MV ELECTRICAL",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*ELECTRICITY_LINE,ELECTRICITY line ----ELECTRICITY----ELECTRICITY----ELECTRICITY----ELECTRICITY----ELECTRICITY----ELECTRICITY--

A,.1,-.1,["ELECTRICITY",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*LANDSCAPING_LINE,LANDSCAPING line ----LANDSCAPING----LANDSCAPING----LANDSCAPING----LANDSCAPING----LANDSCAPING----LANDSCAPING--

A,.1,-.1,["LANDSCAPING",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

*IRRIGATION_LINE,IRRIGATION line ----IRRIGATION----IRRIGATION----IRRIGATION----IRRIGATION----IRRIGATION----IRRIGATION--

A,.1,-.1,["IRRIGATION",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-25

 

example:- when i offset line

layer name:- TELECOM

so my line type in layer also telecom its possible or not

Posted

Have you created your linetype of your own...if yes then where have you save that....

Posted

Just need to add this line as well

 

(VLA-PUT-LINETYPE (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)

Posted
Have you created your linetype of your own...if yes then where have you save that....

 

yes and save my desktop name ma.lin

 

 

(VLA-PUT-LINETYPE (VLAX-ENAME->VLA-OBJECT (ENTLAST)) A)

 

error massage coming

:; error: Automation Error. Key not found

Posted

Have you created *.lin file for every linetype or in that ma.lin file only all linetypes are available???

 

error massage coming

:; error: Automation Error. Key not found

 

Is it coming from my code????

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...