-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attrib & Attdef #65
Attrib & Attdef #65
Conversation
add methods addAttrib, addAttdef
Yes please fix it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this if you can
.eslintrc.json
Outdated
@@ -23,8 +23,7 @@ | |||
2 | |||
], | |||
"linebreak-style": [ | |||
"error", | |||
"unix" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not edit eslint config please
docs/guide/entities.md
Outdated
const blockB = doc.addBlock('blockNameB'); | ||
const msp = doc.modelSpace; | ||
{ | ||
const insertA = msp.addInsert('blockNameA', point3d(0, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you can use:
const insertA = msp.addInsert(blockA.name, point3d(0, 0))
docs/guide/entities.md
Outdated
const attribA = msp.addAttrib(point3d(0,0), 100, 'attributeName', 'attributeValue', insertA) | ||
} | ||
{ | ||
const insertB = msp.addInsert('blockNameB', point3d(0, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here also
@@ -0,0 +1,70 @@ | |||
import {BoundingBox, boundingBox_t} from '../../../Internals/BoundingBox' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use directly Internals/BoundingBox
like defined in paths in tsconfig
this.value = value | ||
this.tag = tag | ||
this.textStyle = 'STANDARD' | ||
this.rotation = options === null || options === void 0 ? void 0 : options.rotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be simplified
this.rotation = options?.rotation
also same for others
@@ -33,6 +34,7 @@ export class Insert extends Entity { | |||
this.rowCount = options?.rowCount || 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when working with numbers best using ?? over ||
import Entity from '../Entity' | ||
|
||
export default class SeqEnd extends Entity { | ||
constructor() { | ||
owner: string|undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be
owner?: string
in constructor just
this.owner = owner
super('SEQEND') | ||
this.owner = owner || undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you need this owner here you can change on the instance directly
addAttrib(firstAlignmentPoint: vec3_t, height: number, tag: string, value: string, ownerInsert: Insert, options?: TextOptions) { | ||
ownerInsert.attributesFollowFlag = 1 | ||
const attrib = this.addEntity(new Attrib(firstAlignmentPoint, height, tag, value, options)) | ||
this.addEntity(new SeqEnd(ownerInsert.handle)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass the owner like that you can change it. You are basically doing this
const seqEnd = this.addEntity(new SeqEnd())
seqEnd.ownerBlockRecord = ownerInsert.handle
@@ -55,10 +55,10 @@ export default abstract class Entity implements DxfInterface { | |||
return BoundingBox.pointBBox(point3d(0, 0, 0)) | |||
} | |||
|
|||
dxfy(dx: Dxfier) { | |||
dxfy(dx: Dxfier, fixOwner?: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to modify this
I fixed it. Thanks for the review. |
Hi. I did it for myself, but if it will be useful to you, I can try to make the necessary corrections for the review.
add classes Attdef, Attrib
add methods addAttrib, addAttdef