Jump to content
Developer Wiki and Function Reference Links ×

Setting the line type of a class


DCarpenter

Recommended Posts

For the life of me, I can't figure out where to select the line type of a new class I created inside a PIO. I'm able to change the Line Style of the class with SetClLSN, The index of the dash style I want is found by using GetDashStyleIndex. Now I need to do the next step and change the class line type to the specific index number, but can't seem to find the 'Set' command I need. Any ideas?

i:=GetDashStyleIndex(False,2,.005,.03); {searches/creates for the dash line index number}

SetClLSN('PP- Projection Cone',-2); {sets the line style of the class to 'dash line'}

Thanks in advance for your help.

Dave

Link to comment

Miguel,

Thank you for your response. In a blank drawing template I start with two line types. When I make the changes that you mentioned above the 'ls' value is equal to -3, which makes sense since the GetDashStyleIndex will create a line type if that specific one it's looking for isn't found. Unfortunately when that same value gets processed with the SetClLSN command, The class line remains unchanged.

Any ideas?

Link to comment

Make sure that the line inherits the class style. When you create a line in a pio, it will inherit the pio attributes as shown on the attribute palette (document attributes) when the pio is created. If you want individual objects to have a different class and attributes, you need to assign it to the object before or after it is created. I usually follow these steps to ensure class inheritance:

1. Set attributes by class (i.e. LSByClass, etc) at the beginning of the script.

2. Create object

3. Set object to the target class, as in SetClass(LNewObj,'Class name')

Link to comment

Thanks. I have been able to create a line (object) in my PIO and assign its attributes to be class dependent. What I'm stuck on is how to change the line type of the class to a specific class. I can find the index number of the line type I want using GetDashStyleIndex, but I just cant seem to find the command that changes the line type of the class. SetClLSN doesn't seem be doing the trick. Is there another method to do this by?

Link to comment
  • Vectorworks, Inc Employee

Does the class start off having "None" for the class style?

On an off chance try setting the Class Line Style to Solid then to the line type you want. I noticed some odd behaviors in the dialog when changing form the "None" style directly to a line type.

Link to comment

OK, it works, but not really. Klinzey said it well when he said 'odd behaviors' So here's the code I'm using:

i:=GetDashStyleIndex(False,2,.005,.03);

SetClLSN('PP- Projection Cone',i);

The first line of code finds/creates the appropriate line type and return the correct index number. The second line sets the line type of the class 'PP- Projection Cone' to the desired index line type. Further down in the code I draw a line that uses the line type on that specific class, and it draws it correctly. Everything is running correctly when I run the PIO, the line that the PIO draws is the correct line type. But when I manually check the class in the drawing after executing the PIO it shows me that the line type for that class HAS NOT changed, it's still the default line type. So I convert the PIO (which ran correctly) to a group and select the line that is drawn correctly and look at it's attributes. All the attributes are class dependent, including the line style, but when I click the line type of that line, it shows me that it is drawn with the default line type, but it's actually drawn in a specified line type from the PIO.

Very "odd" indeed, but the PIO runs correctly :)

Thanks Klinzey.

Link to comment

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
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...